mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-25 11:03:47 +03:00
Implementing hidden switch '--force-threads' on request (to force multi-threading in time-based SQLi)
This commit is contained in:
parent
b68891050d
commit
38541b021a
|
@ -763,6 +763,9 @@ def cmdLineParser(argv=None):
|
|||
parser.add_option("--force-dns", dest="forceDns", action="store_true",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
parser.add_option("--force-threads", dest="forceThreads", action="store_true",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
parser.add_option("--smoke-test", dest="smokeTest", action="store_true",
|
||||
help=SUPPRESS_HELP)
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ def _goInference(payload, expression, charsetType=None, firstChar=None, lastChar
|
|||
timeBasedCompare = (kb.technique in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED))
|
||||
|
||||
if not (timeBasedCompare and kb.dnsTest):
|
||||
if (conf.eta or conf.threads > 1) and Backend.getIdentifiedDbms() and not re.search("(COUNT|LTRIM)\(", expression, re.I) and not timeBasedCompare:
|
||||
if (conf.eta or conf.threads > 1) and Backend.getIdentifiedDbms() and not re.search("(COUNT|LTRIM)\(", expression, re.I) and not (timeBasedCompare and not conf.forceThreads):
|
||||
|
||||
if field and re.search("\ASELECT\s+DISTINCT\((.+?)\)\s+FROM", expression, re.I):
|
||||
expression = "SELECT %s FROM (%s)" % (field, expression)
|
||||
|
|
|
@ -146,12 +146,12 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
|||
if showEta:
|
||||
progress = ProgressBar(maxValue=length)
|
||||
|
||||
if timeBasedCompare and conf.threads > 1:
|
||||
if timeBasedCompare and conf.threads > 1 and not conf.forceThreads:
|
||||
warnMsg = "multi-threading is considered unsafe in time-based data retrieval. Going to switch it off automatically"
|
||||
singleTimeWarnMessage(warnMsg)
|
||||
|
||||
if numThreads > 1:
|
||||
if not timeBasedCompare:
|
||||
if not timeBasedCompare or conf.forceThreads:
|
||||
debugMsg = "starting %d thread%s" % (numThreads, ("s" if numThreads > 1 else ""))
|
||||
logger.debug(debugMsg)
|
||||
else:
|
||||
|
@ -597,8 +597,9 @@ def queryOutputLength(expression, payload):
|
|||
infoMsg = "retrieving the length of query output"
|
||||
logger.info(infoMsg)
|
||||
|
||||
lengthExprUnescaped = agent.forgeQueryOutputLength(expression)
|
||||
start = time.time()
|
||||
|
||||
lengthExprUnescaped = agent.forgeQueryOutputLength(expression)
|
||||
count, length = bisection(payload, lengthExprUnescaped, charsetType=CHARSET_TYPE.DIGITS)
|
||||
|
||||
debugMsg = "performed %d queries in %.2f seconds" % (count, calculateDeltaSeconds(start))
|
||||
|
|
Loading…
Reference in New Issue
Block a user