minor code refactoring and implemented issue #95

This commit is contained in:
Bernardo Damele
2012-07-20 21:46:36 +01:00
parent 9cb1c4c0d9
commit b0ab837832
2 changed files with 77 additions and 11 deletions

View File

@@ -282,7 +282,13 @@ class Search:
foundTbl = safeSQLIdentificatorNaming(foundTbl, True)
foundTbls[db].append(foundTbl)
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):
bruteForce = False
@@ -519,6 +525,13 @@ class Search:
else:
foundCols[column][db] = [tbl]
if not foundCols:
warnMsg = "no databases have tables containing any of the "
warnMsg += "provided columns"
logger.warn(warnMsg)
return
conf.dumper.dbColumns(foundCols, colConsider, dbs)
self.dumpFoundColumn(dbs, foundCols, colConsider)
def search(self):
@@ -531,12 +544,12 @@ class Search:
self.searchColumn()
elif conf.tbl:
conf.dumper.dbTables(self.searchTable())
self.searchTable()
elif conf.db:
conf.dumper.lister("found databases", self.searchDb())
else:
errMsg = "missing parameter, provide -D, -T or -C together "
errMsg = "missing parameter, provide -D, -T or -C along "
errMsg += "with --search"
raise sqlmapMissingMandatoryOptionException, errMsg