mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-06 14:49:05 +00:00
Added option --search to work in conjunction with -D (done), -T (soon) or -C (replaces --dump -C) - See #190:
* --search -D foobar: searches all database names like the ones provided * --search -T foobar: searches all databases' table names like the ones provided (soon) * --search -C foobar: replaces --dump -C
This commit is contained in:
@@ -120,6 +120,9 @@ def action():
|
||||
if conf.dumpAll:
|
||||
conf.dbmsHandler.dumpAll()
|
||||
|
||||
if conf.search:
|
||||
conf.dbmsHandler.search()
|
||||
|
||||
if conf.query:
|
||||
dumper.string(conf.query, conf.dbmsHandler.sqlQuery(conf.query))
|
||||
|
||||
|
||||
@@ -1006,7 +1006,7 @@ def normalizePath(path):
|
||||
return retVal
|
||||
|
||||
def safeStringFormat(formatStr, params):
|
||||
retVal = formatStr.replace('%d', '%s')
|
||||
retVal = formatStr.replace("%d", "%s")
|
||||
|
||||
if isinstance(params, str):
|
||||
retVal = retVal.replace("%s", params)
|
||||
@@ -1015,7 +1015,7 @@ def safeStringFormat(formatStr, params):
|
||||
index = 0
|
||||
|
||||
while index != -1:
|
||||
index = retVal.find('%s')
|
||||
index = retVal.find("%s")
|
||||
|
||||
if index != -1:
|
||||
if count < len(params):
|
||||
|
||||
@@ -96,6 +96,7 @@ optDict = {
|
||||
"getColumns": "boolean",
|
||||
"dumpTable": "boolean",
|
||||
"dumpAll": "boolean",
|
||||
"search": "boolean",
|
||||
"user": "string",
|
||||
"db": "string",
|
||||
"tbl": "string",
|
||||
|
||||
@@ -275,6 +275,9 @@ def cmdLineParser():
|
||||
enumeration.add_option("--dump-all", dest="dumpAll", action="store_true",
|
||||
help="Dump all DBMS databases tables entries")
|
||||
|
||||
enumeration.add_option("--search", dest="search", action="store_true",
|
||||
help="Search column(s), table(s) and/or database name(s)")
|
||||
|
||||
enumeration.add_option("-D", dest="db",
|
||||
help="DBMS database to enumerate")
|
||||
|
||||
|
||||
@@ -207,13 +207,6 @@ class queriesHandler(ContentHandler):
|
||||
|
||||
self.__queries.columns = self.__columns
|
||||
|
||||
elif name == "dump_column":
|
||||
self.__dumpColumn = {}
|
||||
self.__dumpColumn["inband"] = { "query": self.__inband, "query2": self.__inband2, "condition": self.__conditionInband, "condition2": self.__conditionInband2 }
|
||||
self.__dumpColumn["blind"] = { "query": self.__blind, "query2": self.__blind2, "count": self.__count, "count2": self.__count2, "condition": self.__conditionBlind, "condition2": self.__conditionBlind2 }
|
||||
|
||||
self.__queries.dumpColumn = self.__dumpColumn
|
||||
|
||||
elif name == "dump_table":
|
||||
self.__dumpTable = {}
|
||||
self.__dumpTable["inband"] = { "query": self.__inband }
|
||||
@@ -221,6 +214,27 @@ class queriesHandler(ContentHandler):
|
||||
|
||||
self.__queries.dumpTable = self.__dumpTable
|
||||
|
||||
elif name == "search_db":
|
||||
self.__searchDb = {}
|
||||
self.__searchDb["inband"] = { "query": self.__inband, "query2": self.__inband2, "condition": self.__conditionInband, "condition2": self.__conditionInband2 }
|
||||
self.__searchDb["blind"] = { "query": self.__blind, "query2": self.__blind2, "count": self.__count, "count2": self.__count2, "condition": self.__conditionBlind, "condition2": self.__conditionBlind2 }
|
||||
|
||||
self.__queries.searchDb = self.__searchDb
|
||||
|
||||
elif name == "search_table":
|
||||
self.__searchTable = {}
|
||||
self.__searchTable["inband"] = { "query": self.__inband, "query2": self.__inband2, "condition": self.__conditionInband, "condition2": self.__conditionInband2 }
|
||||
self.__searchTable["blind"] = { "query": self.__blind, "query2": self.__blind2, "count": self.__count, "count2": self.__count2, "condition": self.__conditionBlind, "condition2": self.__conditionBlind2 }
|
||||
|
||||
self.__queries.searchTable = self.__searchTable
|
||||
|
||||
elif name == "search_column":
|
||||
self.__searchColumn = {}
|
||||
self.__searchColumn["inband"] = { "query": self.__inband, "query2": self.__inband2, "condition": self.__conditionInband, "condition2": self.__conditionInband2 }
|
||||
self.__searchColumn["blind"] = { "query": self.__blind, "query2": self.__blind2, "count": self.__count, "count2": self.__count2, "condition": self.__conditionBlind, "condition2": self.__conditionBlind2 }
|
||||
|
||||
self.__queries.searchColumn = self.__searchColumn
|
||||
|
||||
def queriesParser():
|
||||
"""
|
||||
This function calls a class to parse the default DBMS queries
|
||||
|
||||
Reference in New Issue
Block a user