Minor refactoring related to last couple of commits

This commit is contained in:
Miroslav Stampar 2019-01-22 03:14:23 +01:00
parent 8f13bda035
commit a31ac0376d
10 changed files with 25 additions and 25 deletions

View File

@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME
from lib.core.enums import OS
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.3.1.66"
VERSION = "1.3.1.67"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -985,7 +985,7 @@ def dictionaryAttack(attack_dict):
else:
logger.info("using default dictionary")
dictPaths = filter(None, dictPaths)
dictPaths = [_ for _ in dictPaths if _]
for dictPath in dictPaths:
checkFile(dictPath)

View File

@ -67,7 +67,7 @@ class Enumeration(GenericEnumeration):
else:
dbs = self.getDbs()
for db in filter(None, dbs):
for db in (_ for _ in dbs if _):
dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db)
infoMsg = "fetching tables for database"

View File

@ -83,7 +83,7 @@ class Enumeration(GenericEnumeration):
for db in dbs:
dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db)
dbs = filter(None, dbs)
dbs = [_ for _ in dbs if _]
infoMsg = "fetching tables for database"
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, basestring) else db[0] for db in sorted(dbs)))
@ -110,7 +110,7 @@ class Enumeration(GenericEnumeration):
break
if not isNoneValue(value):
value = filter(None, arrayizeValue(value))
value = [_ for _ in arrayizeValue(value) if _]
value = [safeSQLIdentificatorNaming(unArrayizeValue(_), True) for _ in value]
kb.data.cachedTables[db] = value
@ -340,7 +340,7 @@ class Enumeration(GenericEnumeration):
colQuery = "%s%s" % (colCond, colCondParam)
colQuery = colQuery % unsafeSQLIdentificatorNaming(column)
for db in filter(None, dbs.keys()):
for db in (_ for _ in dbs if _):
db = safeSQLIdentificatorNaming(db)
if conf.excludeSysDbs and db in self.excludeDbsList:

View File

@ -128,7 +128,7 @@ class Enumeration(GenericEnumeration):
for db in dbs:
dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db)
dbs = filter(None, dbs)
dbs = [_ for _ in dbs if _]
infoMsg = "fetching tables for database"
infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db if isinstance(db, basestring) else db[0] for db in sorted(dbs)))

View File

@ -130,8 +130,8 @@ class Custom:
snippet = getSQLSnippet(Backend.getDbms(), filename)
if snippet and all(query.strip().upper().startswith("SELECT") for query in filter(None, snippet.split(';' if ';' in snippet else '\n'))):
for query in filter(None, snippet.split(';' if ';' in snippet else '\n')):
if snippet and all(query.strip().upper().startswith("SELECT") for query in (_ for _ in snippet.split(';' if ';' in snippet else '\n') if _)):
for query in (_ for _ in snippet.split(';' if ';' in snippet else '\n') if _):
query = query.strip()
if query:
conf.dumper.query(query, self.sqlQuery(query))

View File

@ -179,7 +179,7 @@ class Databases:
kb.data.cachedDbs.sort()
if kb.data.cachedDbs:
kb.data.cachedDbs = filter(None, list(set(flattenValue(kb.data.cachedDbs))))
kb.data.cachedDbs = [_ for _ in set(flattenValue(kb.data.cachedDbs)) if _]
return kb.data.cachedDbs
@ -285,7 +285,7 @@ class Databases:
values = inject.getValue(query, blind=False, time=False)
if not isNoneValue(values):
values = filter(None, arrayizeValue(values))
values = [_ for _ in arrayizeValue(values) if _]
if len(values) > 0 and not isListLike(values[0]):
values = [(dbs[0], _) for _ in values]
@ -462,7 +462,7 @@ class Databases:
for col in colList:
colList[colList.index(col)] = safeSQLIdentificatorNaming(col)
colList = filter(None, colList)
colList = [_ for _ in colList if _]
if conf.tbl:
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2, DBMS.HSQLDB, DBMS.H2):

View File

@ -139,7 +139,7 @@ class Entries:
continue
columns = kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)][safeSQLIdentificatorNaming(tbl, True)]
colList = sorted(filter(None, columns.keys()))
colList = sorted(column for column in columns if column)
if conf.exclude:
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]
@ -553,7 +553,7 @@ class Entries:
continue
conf.tbl = table
colList = filter(None, sorted(columns))
colList = filter(column for column in columns if column)
if conf.exclude:
colList = [_ for _ in colList if _ not in conf.exclude.split(',')]

View File

@ -171,7 +171,7 @@ class Users:
else:
users = []
users = filter(None, users)
users = [_ for _ in users if _]
if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct:
if Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008")):
@ -370,7 +370,7 @@ class Users:
else:
users = []
users = filter(None, users)
users = [_ for _ in users if _]
# Set containing the list of DBMS administrators
areAdmins = set()

View File

@ -49,7 +49,7 @@ fe370021c6bc99daf44b2bfc0d1effb3 lib/core/patch.py
7d8a22c582ad201f65b73225e4456170 lib/core/replication.py
3179d34f371e0295dd4604568fb30bcd lib/core/revision.py
d6269c55789f78cf707e09a0f5b45443 lib/core/session.py
ae2061c30dfddcc64719a2ed8f41bd09 lib/core/settings.py
d9ee29595bb4272fda11b3079753cdd6 lib/core/settings.py
4483b4a5b601d8f1c4281071dff21ecc lib/core/shell.py
10fd19b0716ed261e6d04f311f6f527c lib/core/subprocessng.py
9c7b5c6397fb3da33e7a4d7876d159c6 lib/core/target.py
@ -108,7 +108,7 @@ da4bc159e6920f1f7e45c92c39941690 lib/utils/deps.py
f7c64515a3e4fcfe8266ca2be77be565 lib/utils/getch.py
0d497906b06eb82d14da676e9f9c98f5 lib/utils/har.py
d11f7f208ccf3a7753ccc417b4b01901 lib/utils/hashdb.py
8fcdcf21cf037e0673d785489eb6806f lib/utils/hash.py
07412688758500c3b4e46ae7e28e9709 lib/utils/hash.py
17009289bb5c0dc0cceaa483113101e1 lib/utils/htmlentities.py
fb6be55d21a70765e35549af2484f762 lib/utils/__init__.py
833b05c72c9fa60b0a25b0a26f8f31fb lib/utils/pivotdumptable.py
@ -163,14 +163,14 @@ ed2bdb4eb574066521e88241a21f4bf7 plugins/dbms/informix/fingerprint.py
fcbd61e7ac30eb4c8f09ffd341fa27bb plugins/dbms/informix/takeover.py
fb6be55d21a70765e35549af2484f762 plugins/dbms/__init__.py
ad0b369b6b81a427abede09784db91c5 plugins/dbms/maxdb/connector.py
ea186b97a394b61d82ecf7ed22b0cff6 plugins/dbms/maxdb/enumeration.py
c96d31697b0ea9b81a8ae19b00e220f5 plugins/dbms/maxdb/enumeration.py
7886148c3d6114d43aa1d78b0512fe12 plugins/dbms/maxdb/filesystem.py
691c86dc54cf3cc69b0f5a5ea5fe9a3c plugins/dbms/maxdb/fingerprint.py
8ad820fdfd2454363279eda7a9a08e6e plugins/dbms/maxdb/__init__.py
8fe248263926639acf41db3179db13d0 plugins/dbms/maxdb/syntax.py
479ce664674859d0e61c5221f9e835fd plugins/dbms/maxdb/takeover.py
6ef95017815eb5d2d0f5645a6f5c7a79 plugins/dbms/mssqlserver/connector.py
69bfc53a409e79511802f668439bf4be plugins/dbms/mssqlserver/enumeration.py
2f61dfdc00b780d015a8d3b8e9a23d8d plugins/dbms/mssqlserver/enumeration.py
bb02bdf47c71ed93d28d20b98ea0f8c6 plugins/dbms/mssqlserver/filesystem.py
bcabbf98e72bf3c6e971b56d8da60261 plugins/dbms/mssqlserver/fingerprint.py
6bffd484ef47111dd8a6e46e127ab5c7 plugins/dbms/mssqlserver/__init__.py
@ -205,16 +205,16 @@ fb018fd23dcebdb36dddd22ac92efa2c plugins/dbms/postgresql/__init__.py
1ca5b1d7c64686827e80988933c397fa plugins/dbms/sqlite/syntax.py
224835bf71e99bac6e50b689afac5122 plugins/dbms/sqlite/takeover.py
1f726d02ce4c709c0a3d327be947c72b plugins/dbms/sybase/connector.py
37a4e529dfb6bf3387c22e66cd9966f7 plugins/dbms/sybase/enumeration.py
ac1cef8f0d14be9ea71e6627e25a9c60 plugins/dbms/sybase/enumeration.py
9f16fb52a70e5fb01876f1bc5f5ef532 plugins/dbms/sybase/filesystem.py
69c104c5a2ff3e2c88a41205bb96d812 plugins/dbms/sybase/fingerprint.py
2fae8e5d100fc9fb70769e483c29e8fb plugins/dbms/sybase/__init__.py
ec3f406591fc9472f5750bd40993e72e plugins/dbms/sybase/syntax.py
369476221b3059106410de05766227e0 plugins/dbms/sybase/takeover.py
312020bc31ffb0bc6077f62e6fff6e73 plugins/generic/connector.py
1ea0b0e7aa15b7687e1b00845e33f9ab plugins/generic/custom.py
f0ee05d8c97dc2ca20b39512a1cc9f99 plugins/generic/databases.py
e1c9b3c9b14e71c06381dd6832119158 plugins/generic/entries.py
d749b7f7b4bcf1f646290dec739f1e6d plugins/generic/custom.py
791db3be35714c9a2e55a7abe9127da4 plugins/generic/databases.py
8a70329d0bfc21cf89b7a46118d16d17 plugins/generic/entries.py
f3624debb8ae6fbcfb5f1b7f1d0743d1 plugins/generic/enumeration.py
cda119b7b0d1afeb60f912009cdb0cf5 plugins/generic/filesystem.py
65e75cd3c2c7acffa6ac13b086e0f383 plugins/generic/fingerprint.py
@ -223,7 +223,7 @@ de1928d6865547764ae9a896da4bf1d4 plugins/generic/misc.py
c95bf3dec22cc638100efef99e2ccc3c plugins/generic/search.py
1989f6cbed217f4222dc2dce72992d91 plugins/generic/syntax.py
44c388ea08d4296e2bf2706e19cbe64a plugins/generic/takeover.py
a4b9f764140e89279e3d0dace99bfa5f plugins/generic/users.py
f57914512ae22521b988b5094f1a0d6f plugins/generic/users.py
fb6be55d21a70765e35549af2484f762 plugins/__init__.py
5dc693e22f5d020c5c568d7325bd4226 shell/backdoors/backdoor.asp_
158bfa168128393dde8d6ed11fe9a1b8 shell/backdoors/backdoor.aspx_