From ea4cef9c6d3bde2e7479c5e96657fec2459809d7 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 24 Sep 2015 13:44:51 +0200 Subject: [PATCH] Skipping quit exception in case of --search --- plugins/dbms/mssqlserver/enumeration.py | 2 +- plugins/generic/databases.py | 6 ++++-- plugins/generic/entries.py | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/dbms/mssqlserver/enumeration.py b/plugins/dbms/mssqlserver/enumeration.py index 0aa86ae32..a653b964b 100644 --- a/plugins/dbms/mssqlserver/enumeration.py +++ b/plugins/dbms/mssqlserver/enumeration.py @@ -152,7 +152,7 @@ class Enumeration(GenericEnumeration): warnMsg += "for database '%s'" % db logger.warn(warnMsg) - if not kb.data.cachedTables: + if not kb.data.cachedTables and not conf.search: errMsg = "unable to retrieve the tables for any database" raise SqlmapNoneDataException(errMsg) else: diff --git a/plugins/generic/databases.py b/plugins/generic/databases.py index dba018808..b9eed29b9 100644 --- a/plugins/generic/databases.py +++ b/plugins/generic/databases.py @@ -358,7 +358,7 @@ class Databases: if bruteForce is None: logger.error(errMsg) return self.getTables(bruteForce=True) - else: + elif not conf.search: raise SqlmapNoneDataException(errMsg) else: for db, tables in kb.data.cachedTables.items(): @@ -432,10 +432,12 @@ class Databases: tblList = tblList[0] tblList = list(tblList) - else: + elif not conf.search: errMsg = "unable to retrieve the tables " errMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(conf.db) raise SqlmapNoneDataException(errMsg) + else: + return kb.data.cachedColumns tblList = filter(None, (safeSQLIdentificatorNaming(_, True) for _ in tblList)) diff --git a/plugins/generic/entries.py b/plugins/generic/entries.py index dcfe3f4f5..8a9a05b18 100644 --- a/plugins/generic/entries.py +++ b/plugins/generic/entries.py @@ -89,10 +89,12 @@ class Entries: if isinstance(tblList[0], (set, tuple, list)): tblList = tblList[0] - else: + elif not conf.search: errMsg = "unable to retrieve the tables " errMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(conf.db) raise SqlmapNoneDataException(errMsg) + else: + return for tbl in tblList: tblList[tblList.index(tbl)] = safeSQLIdentificatorNaming(tbl, True)