Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e3a4eb

Browse files
committed
Added a prompt for choosing a number of threads when in crawling mode
1 parent 2aadfc0 commit 4e3a4eb

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

lib/core/threads.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
106106
kb.threadContinue = True
107107
kb.threadException = False
108108

109-
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)):
109+
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)):
110110
while True:
111111
message = "please enter number of threads? [Enter for %d (current)] " % numThreads
112112
choice = readInput(message, default=str(numThreads))
@@ -115,11 +115,11 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
115115
errMsg = "maximum number of used threads is %d avoiding potential connection issues" % MAX_NUMBER_OF_THREADS
116116
logger.critical(errMsg)
117117
else:
118-
numThreads = int(choice)
118+
conf.threads = numThreads = int(choice)
119119
break
120120

121121
if numThreads == 1:
122-
warnMsg = "running in a single-thread mode. This could take a while."
122+
warnMsg = "running in a single-thread mode. This could take a while"
123123
logger.warn(warnMsg)
124124

125125
try:

lib/utils/crawler.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,14 @@ def crawlThread():
115115
logger.info(infoMsg)
116116

117117
for i in xrange(conf.crawlDepth):
118-
if i > 0 and conf.threads == 1:
119-
singleTimeWarnMessage("running in a single-thread mode. This could take a while")
120-
121118
threadData.shared.count = 0
122119
threadData.shared.length = len(threadData.shared.unprocessed)
123120
numThreads = min(conf.threads, len(threadData.shared.unprocessed))
124121

125122
if not conf.bulkFile:
126123
logger.info("searching for links with depth %d" % (i + 1))
127124

128-
runThreads(numThreads, crawlThread)
125+
runThreads(numThreads, crawlThread, threadChoice=(i>0))
129126
clearConsoleLine(True)
130127

131128
if threadData.shared.deeper:

0 commit comments

Comments
 (0)