Skip to content

Commit e498694

Browse files
committed
Fix for a NoneType/--columns issue reported over ML
1 parent 5882ab5 commit e498694

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugins/generic/databases.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ def getColumns(self, onlyColNames=False, colTuple=None, bruteForce=None):
378378

379379
conf.db = self.getCurrentDb()
380380

381+
if not conf.db:
382+
errMsg = "unable to retrieve the current "
383+
errMsg += "database name"
384+
raise SqlmapNoneDataException(errMsg)
385+
381386
elif conf.db is not None:
382387
if Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2, DBMS.HSQLDB):
383388
conf.db = conf.db.upper()
@@ -425,8 +430,7 @@ def getColumns(self, onlyColNames=False, colTuple=None, bruteForce=None):
425430
errMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
426431
raise SqlmapNoneDataException(errMsg)
427432

428-
for tbl in tblList:
429-
tblList[tblList.index(tbl)] = safeSQLIdentificatorNaming(tbl, True)
433+
tblList = filter(None, (safeSQLIdentificatorNaming(_, True) for _ in tblList))
430434

431435
if bruteForce is None:
432436
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:

0 commit comments

Comments
 (0)