From d27afaed7ebf55f767d6792677fcb9bf1eb25d21 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 16 Jun 2011 14:27:44 +0000 Subject: [PATCH] some fixes --- lib/techniques/brute/use.py | 4 ++-- plugins/dbms/maxdb/enumeration.py | 4 ++-- plugins/dbms/mssqlserver/enumeration.py | 7 +++++-- plugins/generic/enumeration.py | 6 ++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/techniques/brute/use.py b/lib/techniques/brute/use.py index 720e194f2..31b4f7b22 100644 --- a/lib/techniques/brute/use.py +++ b/lib/techniques/brute/use.py @@ -66,7 +66,7 @@ def tableExists(tableFile, regex=None): while kb.threadContinue: kb.locks.countLock.acquire() if threadData.shared.count < threadData.shared.limit: - table = safeSQLIdentificatorNaming(tables[threadData.shared.count]) + table = safeSQLIdentificatorNaming(tables[threadData.shared.count], True) threadData.shared.count += 1 kb.locks.countLock.release() else: @@ -137,7 +137,7 @@ def columnExists(columnFile, regex=None): table = "%s%s%s" % (conf.db, '..' if Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE) else '.', conf.tbl) else: table = conf.tbl - table = safeSQLIdentificatorNaming(table) + table = safeSQLIdentificatorNaming(table, True) infoMsg = "checking column existence using items from '%s'" % columnFile logger.info(infoMsg) diff --git a/plugins/dbms/maxdb/enumeration.py b/plugins/dbms/maxdb/enumeration.py index 37aae2dc3..a14ba4dc9 100644 --- a/plugins/dbms/maxdb/enumeration.py +++ b/plugins/dbms/maxdb/enumeration.py @@ -129,8 +129,8 @@ class Enumeration(GenericEnumeration): for tbl in tblList: if conf.db is not None and len(kb.data.cachedColumns) > 0 \ - and conf.db in kb.data.cachedColumns and tbl in \ - kb.data.cachedColumns[conf.db]: + and conf.db in kb.data.cachedColumns and tbl in \ + kb.data.cachedColumns[conf.db]: infoMsg = "fetched tables' columns on " infoMsg += "database '%s'" % conf.db logger.info(infoMsg) diff --git a/plugins/dbms/mssqlserver/enumeration.py b/plugins/dbms/mssqlserver/enumeration.py index 4bcd49414..90b79cb4f 100644 --- a/plugins/dbms/mssqlserver/enumeration.py +++ b/plugins/dbms/mssqlserver/enumeration.py @@ -299,7 +299,9 @@ class Enumeration(GenericEnumeration): conf.col = column self.getColumns(onlyColNames=True) - if kb.data.cachedColumns[db][foundTbl] != {None: None}: + + if db in kb.data.cachedColumns and foundTbl in kb.data.cachedColumns[db]\ + and not isNoneValue(kb.data.cachedColumns[db][foundTbl]): dbs[db][foundTbl].update(kb.data.cachedColumns[db][foundTbl]) kb.data.cachedColumns = {} else: @@ -355,7 +357,8 @@ class Enumeration(GenericEnumeration): self.getColumns(onlyColNames=True) - dbs[db][tbl].update(kb.data.cachedColumns[db][tbl]) + if db in kb.data.cachedColumns and tbl in kb.data.cachedColumns[db]: + dbs[db][tbl].update(kb.data.cachedColumns[db][tbl]) kb.data.cachedColumns = {} else: dbs[db][tbl][column] = None diff --git a/plugins/generic/enumeration.py b/plugins/generic/enumeration.py index 8bda1d41d..395224c1d 100644 --- a/plugins/generic/enumeration.py +++ b/plugins/generic/enumeration.py @@ -2144,7 +2144,8 @@ class Enumeration: self.getColumns(onlyColNames=True) - dbs[foundDb][foundTbl].update(kb.data.cachedColumns[foundDb][foundTbl]) + if foundDb in kb.data.cachedColumns and foundTbl in kb.data.cachedColumns[foundDb]: + dbs[foundDb][foundTbl].update(kb.data.cachedColumns[foundDb][foundTbl]) kb.data.cachedColumns = {} else: dbs[foundDb][foundTbl][column] = None @@ -2240,7 +2241,8 @@ class Enumeration: self.getColumns(onlyColNames=True) - dbs[db][tbl].update(kb.data.cachedColumns[db][tbl]) + if db in kb.data.cachedColumns and tbl in kb.data.cachedColumns[db]: + dbs[db][tbl].update(kb.data.cachedColumns[db][tbl]) kb.data.cachedColumns = {} else: dbs[db][tbl][column] = None