Skip to content

Commit 43d9ac2

Browse files
committed
Patch related to the sqlmapproject#3101
1 parent d8196cf commit 43d9ac2

3 files changed

Lines changed: 39 additions & 3 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

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

plugins/generic/databases.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,24 @@ def getTables(self, bruteForce=None):
290290
db = safeSQLIdentificatorNaming(db)
291291
table = safeSQLIdentificatorNaming(unArrayizeValue(table), True)
292292

293+
if conf.getComments:
294+
_ = queries[Backend.getIdentifiedDbms()].table_comment
295+
if hasattr(_, "query"):
296+
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
297+
query = _.query % (unsafeSQLIdentificatorNaming(db.upper()), unsafeSQLIdentificatorNaming(table.upper()))
298+
else:
299+
query = _.query % (unsafeSQLIdentificatorNaming(db), unsafeSQLIdentificatorNaming(table))
300+
301+
comment = unArrayizeValue(inject.getValue(query, blind=False, time=False))
302+
if not isNoneValue(comment):
303+
infoMsg = "retrieved comment '%s' for table '%s' " % (comment, unsafeSQLIdentificatorNaming(table))
304+
infoMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(db)
305+
logger.info(infoMsg)
306+
else:
307+
warnMsg = "on %s it is not " % Backend.getIdentifiedDbms()
308+
warnMsg += "possible to get column comments"
309+
singleTimeWarnMessage(warnMsg)
310+
293311
if db not in kb.data.cachedTables:
294312
kb.data.cachedTables[db] = [table]
295313
else:
@@ -353,6 +371,24 @@ def getTables(self, bruteForce=None):
353371
table = safeSQLIdentificatorNaming(table, True)
354372
tables.append(table)
355373

374+
if conf.getComments:
375+
_ = queries[Backend.getIdentifiedDbms()].table_comment
376+
if hasattr(_, "query"):
377+
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2):
378+
query = _.query % (unsafeSQLIdentificatorNaming(db.upper()), unsafeSQLIdentificatorNaming(table.upper()))
379+
else:
380+
query = _.query % (unsafeSQLIdentificatorNaming(db), unsafeSQLIdentificatorNaming(table))
381+
382+
comment = unArrayizeValue(inject.getValue(query, union=False, error=False))
383+
if not isNoneValue(comment):
384+
infoMsg = "retrieved comment '%s' for table '%s' " % (comment, unsafeSQLIdentificatorNaming(table))
385+
infoMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(db)
386+
logger.info(infoMsg)
387+
else:
388+
warnMsg = "on %s it is not " % Backend.getIdentifiedDbms()
389+
warnMsg += "possible to get column comments"
390+
singleTimeWarnMessage(warnMsg)
391+
356392
if tables:
357393
kb.data.cachedTables[db] = tables
358394
else:

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ c9a56e58984420a5abb7a3f7aadc196d lib/core/optiondict.py
4747
0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py
4848
a7db43859b61569b601b97f187dd31c5 lib/core/revision.py
4949
fcb74fcc9577523524659ec49e2e964b lib/core/session.py
50-
7b3e526a8b77e167e0572e1ec52e2d62 lib/core/settings.py
50+
61a242f506d7e3374230b2e904ea309b lib/core/settings.py
5151
0dfc2ed40adf72e302291f6ecd4406f6 lib/core/shell.py
5252
a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py
5353
6306284edcccc185b2df085438572b0d lib/core/target.py
@@ -204,7 +204,7 @@ a3db8618eed5bb2807b6f77605cba9cc plugins/dbms/sybase/__init__.py
204204
79f6c7017db4ded8f74a0117188836ff plugins/dbms/sybase/takeover.py
205205
34d181a7086d6dfc7e72ae5f8a4cfe0f plugins/generic/connector.py
206206
e6cd1c5a5244d83396b401f7db43d323 plugins/generic/custom.py
207-
79c6dbcb7e6ad5e993a44aa52fdc36ed plugins/generic/databases.py
207+
156c227dbe765da3d0fd2976fbe18d8b plugins/generic/databases.py
208208
4e2b366bb9cfdaaed719b219913357c6 plugins/generic/entries.py
209209
d82f2c78c1d4d7c6487e94fd3a68a908 plugins/generic/enumeration.py
210210
0c8abe66a78edca0660bfb8049d109e2 plugins/generic/filesystem.py

0 commit comments

Comments
 (0)