diff --git a/plugins/dbms/mssqlserver/enumeration.py b/plugins/dbms/mssqlserver/enumeration.py index 5f6754634..1cfaa3112 100644 --- a/plugins/dbms/mssqlserver/enumeration.py +++ b/plugins/dbms/mssqlserver/enumeration.py @@ -158,15 +158,16 @@ class Enumeration(GenericEnumeration): return kb.data.cachedTables def searchTable(self): - rootQuery = queries[Backend.getIdentifiedDbms()].search_table foundTbls = {} tblList = conf.tbl.split(",") + rootQuery = queries[Backend.getIdentifiedDbms()].search_table tblCond = rootQuery.inband.condition #dbCond = rootQuery.inband.condition2 - tblConsider, tblCondParam = self.likeOrExact("table") - if not len(kb.data.cachedDbs): + if conf.db and conf.db != CURRENT_DB: + enumDbs = conf.db.split(",") + elif not len(kb.data.cachedDbs): enumDbs = self.getDbs() else: enumDbs = kb.data.cachedDbs @@ -247,7 +248,13 @@ class Enumeration(GenericEnumeration): if len(tbls) == 0: foundTbls.pop(db) - return foundTbls + if not foundTbls: + warnMsg = "no databases contain any of the provided tables" + logger.warn(warnMsg) + return + + conf.dumper.dbTables(foundTbls) + self.dumpFoundTables(foundTbls) def searchColumn(self): rootQuery = queries[Backend.getIdentifiedDbms()].search_column diff --git a/plugins/generic/search.py b/plugins/generic/search.py index 34dbaf798..3f7c269db 100644 --- a/plugins/generic/search.py +++ b/plugins/generic/search.py @@ -154,12 +154,10 @@ class Search: foundTbls = {} tblList = conf.tbl.split(",") - rootQuery = queries[Backend.getIdentifiedDbms()].search_table tblCond = rootQuery.inband.condition dbCond = rootQuery.inband.condition2 whereDbsQuery = "" - tblConsider, tblCondParam = self.likeOrExact("table") for tbl in tblList: