Skip to content

Commit 3378f8d

Browse files
committed
Minor patches for -d
1 parent ab59a4b commit 3378f8d

7 files changed

Lines changed: 29 additions & 12 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.7.81"
23+
VERSION = "1.10.7.82"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

plugins/dbms/cache/connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def connect(self):
4646
try:
4747
driver = 'com.intersys.jdbc.CacheDriver'
4848
connection_string = 'jdbc:Cache://%s:%d/%s' % (self.hostname, self.port, self.db)
49-
self.connector = jaydebeapi.connect(driver, connection_string, str(self.user), str(self.password))
49+
self.connector = jaydebeapi.connect(driver, connection_string, [str(self.user), str(self.password)])
5050
except Exception as ex:
5151
raise SqlmapConnectionException(getSafeExString(ex))
5252

plugins/dbms/cubrid/connector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ def connect(self):
3030
self.initConnection()
3131

3232
try:
33-
self.connector = CUBRIDdb.connect(hostname=self.hostname, username=self.user, password=self.password, database=self.db, port=self.port, connect_timeout=conf.timeout)
34-
except CUBRIDdb.DatabaseError as ex:
33+
# CUBRIDdb.connect takes a positional URL 'CUBRID:host:port:db:::' then user/password positionally
34+
# (it does not accept hostname/username/database keyword args, which raised a TypeError before)
35+
self.connector = CUBRIDdb.connect("CUBRID:%s:%s:%s:::" % (self.hostname, self.port, self.db), str(self.user), str(self.password))
36+
except Exception as ex:
3537
raise SqlmapConnectionException(getSafeExString(ex))
3638

3739
self.initCursor()

plugins/dbms/hsqldb/connector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def connect(self):
4545

4646
try:
4747
driver = 'org.hsqldb.jdbc.JDBCDriver'
48-
connection_string = 'jdbc:hsqldb:mem:.' # 'jdbc:hsqldb:hsql://%s/%s' % (self.hostname, self.db)
49-
self.connector = jaydebeapi.connect(driver, connection_string, str(self.user), str(self.password))
48+
connection_string = 'jdbc:hsqldb:hsql://%s:%s/%s' % (self.hostname, self.port, self.db) # was hardcoded to 'jdbc:hsqldb:mem:.' (a fresh empty in-memory DB), ignoring the -d target
49+
self.connector = jaydebeapi.connect(driver, connection_string, [str(self.user), str(self.password)])
5050
except Exception as ex:
5151
raise SqlmapConnectionException(getSafeExString(ex))
5252

plugins/dbms/mimersql/connector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ def connect(self):
3030
self.initConnection()
3131

3232
try:
33-
self.connector = mimerpy.connect(hostname=self.hostname, username=self.user, password=self.password, database=self.db, port=self.port, connect_timeout=conf.timeout)
34-
except mimerpy.OperationalError as ex:
33+
# mimerpy.connect uses dsn/user/password (host/port come from Mimer's sqlhosts/MIMER_DATABASE
34+
# configuration, not connect() kwargs); the previous hostname/username/... kwargs raised a TypeError
35+
self.connector = mimerpy.connect(dsn=self.db, user=str(self.user), password=str(self.password))
36+
except Exception as ex:
3537
raise SqlmapConnectionException(getSafeExString(ex))
3638

3739
self.initCursor()

plugins/dbms/oracle/connector.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ class Connector(GenericConnector):
3232
def connect(self):
3333
self.initConnection()
3434

35+
# Fetch CLOB/BLOB values directly as str/bytes instead of oracledb.LOB objects; otherwise a LOB cell
36+
# reached the renderer as the repr '<oracledb.LOB object at 0x...>' (BLOB bytes are then hex-encoded
37+
# by direct()'s binary handling).
38+
try:
39+
oracledb.defaults.fetch_lobs = False
40+
except AttributeError:
41+
pass
42+
3543
self.user = getText(self.user)
3644
self.password = getText(self.password)
3745

plugins/dbms/vertica/connector.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,21 @@ def fetchall(self):
4444
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
4545
return None
4646

47-
def execute(self, query):
47+
def execute(self, query, commit=True):
4848
try:
4949
self.cursor.execute(query)
5050
except (vertica_python.OperationalError, vertica_python.ProgrammingError) as ex:
5151
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
5252
except vertica_python.InternalError as ex:
5353
raise SqlmapConnectionException(getSafeExString(ex))
5454

55-
self.connector.commit()
55+
# commit non-SELECT (DML) here; select() commits only AFTER fetchall() because vertica_python shares one
56+
# cursor per connection and commit() runs COMMIT through it, discarding the unfetched result set
57+
if commit:
58+
self.connector.commit()
5659

5760
def select(self, query):
58-
self.execute(query)
59-
return self.fetchall()
61+
self.execute(query, commit=False)
62+
retVal = self.fetchall()
63+
self.connector.commit()
64+
return retVal

0 commit comments

Comments
 (0)