mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 04:53:48 +03:00
Added a prompt for choosing a number of threads when in crawling mode
This commit is contained in:
parent
2aadfc0fd3
commit
4e3a4eb0ff
|
@ -106,7 +106,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
|
|||
kb.threadContinue = True
|
||||
kb.threadException = False
|
||||
|
||||
if threadChoice and numThreads == 1 and any(_ in kb.injection.data for _ in (PAYLOAD.TECHNIQUE.BOOLEAN, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY, PAYLOAD.TECHNIQUE.UNION)):
|
||||
if threadChoice and numThreads == 1 and not (kb.injection.data and not any(_ not in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED) for _ in kb.injection.data)):
|
||||
while True:
|
||||
message = "please enter number of threads? [Enter for %d (current)] " % numThreads
|
||||
choice = readInput(message, default=str(numThreads))
|
||||
|
@ -115,11 +115,11 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
|
|||
errMsg = "maximum number of used threads is %d avoiding potential connection issues" % MAX_NUMBER_OF_THREADS
|
||||
logger.critical(errMsg)
|
||||
else:
|
||||
numThreads = int(choice)
|
||||
conf.threads = numThreads = int(choice)
|
||||
break
|
||||
|
||||
if numThreads == 1:
|
||||
warnMsg = "running in a single-thread mode. This could take a while."
|
||||
warnMsg = "running in a single-thread mode. This could take a while"
|
||||
logger.warn(warnMsg)
|
||||
|
||||
try:
|
||||
|
|
|
@ -115,9 +115,6 @@ def crawl(target):
|
|||
logger.info(infoMsg)
|
||||
|
||||
for i in xrange(conf.crawlDepth):
|
||||
if i > 0 and conf.threads == 1:
|
||||
singleTimeWarnMessage("running in a single-thread mode. This could take a while")
|
||||
|
||||
threadData.shared.count = 0
|
||||
threadData.shared.length = len(threadData.shared.unprocessed)
|
||||
numThreads = min(conf.threads, len(threadData.shared.unprocessed))
|
||||
|
@ -125,7 +122,7 @@ def crawl(target):
|
|||
if not conf.bulkFile:
|
||||
logger.info("searching for links with depth %d" % (i + 1))
|
||||
|
||||
runThreads(numThreads, crawlThread)
|
||||
runThreads(numThreads, crawlThread, threadChoice=(i>0))
|
||||
clearConsoleLine(True)
|
||||
|
||||
if threadData.shared.deeper:
|
||||
|
|
Loading…
Reference in New Issue
Block a user