diff --git a/plugins/dbms/maxdb/enumeration.py b/plugins/dbms/maxdb/enumeration.py index 6f8e9fb52..2afb0b350 100644 --- a/plugins/dbms/maxdb/enumeration.py +++ b/plugins/dbms/maxdb/enumeration.py @@ -64,7 +64,7 @@ class Enumeration(GenericEnumeration): else: dbs = self.getDbs() - for db in dbs: + for db in filter(None, dbs): dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db) infoMsg = "fetching tables for database" diff --git a/plugins/dbms/mssqlserver/enumeration.py b/plugins/dbms/mssqlserver/enumeration.py index bcc4b342d..016f18198 100644 --- a/plugins/dbms/mssqlserver/enumeration.py +++ b/plugins/dbms/mssqlserver/enumeration.py @@ -77,6 +77,8 @@ class Enumeration(GenericEnumeration): for db in dbs: dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db) + dbs = filter(None, dbs) + infoMsg = "fetching tables for database" infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db for db in sorted(dbs))) logger.info(infoMsg) diff --git a/plugins/dbms/sybase/enumeration.py b/plugins/dbms/sybase/enumeration.py index 2e4c5f8e1..2c40fae03 100644 --- a/plugins/dbms/sybase/enumeration.py +++ b/plugins/dbms/sybase/enumeration.py @@ -120,6 +120,8 @@ class Enumeration(GenericEnumeration): for db in dbs: dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db) + dbs = filter(None, dbs) + infoMsg = "fetching tables for database" infoMsg += "%s: %s" % ("s" if len(dbs) > 1 else "", ", ".join(db for db in sorted(dbs))) logger.info(infoMsg) diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index 59ce9797d..d21ac3379 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -252,6 +252,8 @@ class Enumeration: else: users = [] + users = filter(None, users) + if isTechniqueAvailable(PAYLOAD.TECHNIQUE.UNION) or isTechniqueAvailable(PAYLOAD.TECHNIQUE.ERROR) or conf.direct: if Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008")): query = rootQuery.inband.query2 @@ -447,6 +449,8 @@ class Enumeration: else: users = [] + users = filter(None, users) + # Set containing the list of DBMS administrators areAdmins = set() @@ -830,6 +834,8 @@ class Enumeration: for db in dbs: dbs[dbs.index(db)] = safeSQLIdentificatorNaming(db) + dbs = filter(None, dbs) + if bruteForce: resumeAvailable = False @@ -998,6 +1004,8 @@ class Enumeration: for col in colList: colList[colList.index(col)] = safeSQLIdentificatorNaming(col) + colList = filter(None, colList) + if conf.tbl: if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2): conf.tbl = conf.tbl.upper() @@ -1388,7 +1396,7 @@ class Enumeration: lengths[column] = 0 entries[column] = BigArray() - colList = sorted(colList, key=lambda x: len(x) if x else MAX_INT) + colList = filter(None, sorted(colList, key=lambda x: len(x) if x else MAX_INT)) for column in colList: infoMsg = "fetching number of distinct " @@ -1550,7 +1558,7 @@ class Enumeration: continue - colList = kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)][safeSQLIdentificatorNaming(tbl, True)].keys() + colList = filter(None, kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)][safeSQLIdentificatorNaming(tbl, True)].keys()) colString = ", ".join(column for column in sorted(colList)) rootQuery = queries[Backend.getIdentifiedDbms()].dump_table @@ -1856,7 +1864,7 @@ class Enumeration: continue conf.tbl = table - conf.col = ",".join(column for column in sorted(columns)) + conf.col = ",".join(column for column in filter(None, sorted(columns))) kb.data.cachedColumns = {} kb.data.dumpedTable = {}