diff --git a/lib/core/dump.py b/lib/core/dump.py index 43ec32c34..a20b9871d 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -211,10 +211,9 @@ class Dump: for column in colList: colType = columns[column] - maxlength1 = max(maxlength1, len(column)) - if colType is not None: - maxlength2 = max(maxlength2, len(colType)) + maxlength1 = max(maxlength1, len(column or "")) + maxlength2 = max(maxlength2, len(colType or "")) maxlength1 = max(maxlength1, len("COLUMN")) lines1 = "-" * (maxlength1 + 2) diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index 659b36cb6..f65b88962 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -1141,10 +1141,11 @@ class Enumeration: if not isNoneValue(columnData): name = safeSQLIdentificatorNaming(columnData[0]) - if len(columnData) == 1: - columns[name] = "" - else: - columns[name] = columnData[1] + if name: + if len(columnData) == 1: + columns[name] = "" + else: + columns[name] = columnData[1] if conf.db in kb.data.cachedColumns: kb.data.cachedColumns[safeSQLIdentificatorNaming(conf.db)][safeSQLIdentificatorNaming(tbl, True)] = columns @@ -1242,27 +1243,28 @@ class Enumeration: query = agent.limitQuery(index, query, field) column = inject.getValue(query, inband=False, error=False) - if not onlyColNames: - if Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ): - query = rootQuery.blind.query2 % (unsafeSQLIdentificatorNaming(tbl), column, unsafeSQLIdentificatorNaming(conf.db)) - elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2): - query = rootQuery.blind.query2 % (unsafeSQLIdentificatorNaming(tbl.upper()), column) - elif Backend.isDbms(DBMS.MSSQL): - query = rootQuery.blind.query2 % (conf.db, conf.db, conf.db, conf.db, column, conf.db, - conf.db, conf.db, unsafeSQLIdentificatorNaming(tbl)) - elif Backend.isDbms(DBMS.FIREBIRD): - query = rootQuery.blind.query2 % (tbl, column) + if not isNoneValue(column): + if not onlyColNames: + if Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ): + query = rootQuery.blind.query2 % (unsafeSQLIdentificatorNaming(tbl), column, unsafeSQLIdentificatorNaming(conf.db)) + elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2): + query = rootQuery.blind.query2 % (unsafeSQLIdentificatorNaming(tbl.upper()), column) + elif Backend.isDbms(DBMS.MSSQL): + query = rootQuery.blind.query2 % (conf.db, conf.db, conf.db, conf.db, column, conf.db, + conf.db, conf.db, unsafeSQLIdentificatorNaming(tbl)) + elif Backend.isDbms(DBMS.FIREBIRD): + query = rootQuery.blind.query2 % (tbl, column) - colType = inject.getValue(query, inband=False, error=False) + colType = inject.getValue(query, inband=False, error=False) - if Backend.isDbms(DBMS.FIREBIRD): - colType = firebirdTypes.get(colType, colType) + if Backend.isDbms(DBMS.FIREBIRD): + colType = firebirdTypes.get(colType, colType) - column = safeSQLIdentificatorNaming(column) - columns[column] = colType - else: - column = safeSQLIdentificatorNaming(column) - columns[column] = None + column = safeSQLIdentificatorNaming(column) + columns[column] = colType + else: + column = safeSQLIdentificatorNaming(column) + columns[column] = None if columns: if conf.db in kb.data.cachedColumns: