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

Skip to content

Commit 76f79ec

Browse files
committed
run like --threads=20! will skip the maximum number of threads check
1 parent 4f122ee commit 76f79ec

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

lib/core/option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,7 @@ def _basicOptionValidation():
21902190
errMsg = "switch '--predict-output' is incompatible with option '--threads' and switch '-o'"
21912191
raise SqlmapSyntaxException(errMsg)
21922192

2193-
if conf.threads > MAX_NUMBER_OF_THREADS:
2193+
if conf.threads > MAX_NUMBER_OF_THREADS and not conf.get("skipThreadCheck"):
21942194
errMsg = "maximum number of used threads is %d avoiding potential connection issues" % MAX_NUMBER_OF_THREADS
21952195
raise SqlmapSyntaxException(errMsg)
21962196

lib/core/threads.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,18 @@ def runThreads(numThreads, threadFunction, cleanupFunction=None, forwardExceptio
110110
while True:
111111
message = "please enter number of threads? [Enter for %d (current)] " % numThreads
112112
choice = readInput(message, default=str(numThreads))
113-
if choice and choice.isdigit():
114-
if int(choice) > MAX_NUMBER_OF_THREADS:
115-
errMsg = "maximum number of used threads is %d avoiding potential connection issues" % MAX_NUMBER_OF_THREADS
116-
logger.critical(errMsg)
117-
else:
118-
conf.threads = numThreads = int(choice)
119-
break
113+
if choice:
114+
skipThreadCheck = False
115+
if choice.endswith('!'):
116+
choice = choice[:-1]
117+
skipThreadCheck = True
118+
if choice.isdigit():
119+
if int(choice) > MAX_NUMBER_OF_THREADS and not skipThreadCheck:
120+
errMsg = "maximum number of used threads is %d avoiding potential connection issues" % MAX_NUMBER_OF_THREADS
121+
logger.critical(errMsg)
122+
else:
123+
conf.threads = numThreads = int(choice)
124+
break
120125

121126
if numThreads == 1:
122127
warnMsg = "running in a single-thread mode. This could take a while"

lib/parse/cmdline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
import os
9+
import re
910
import shlex
1011
import sys
1112

@@ -850,6 +851,9 @@ def _(self, *args):
850851
for i in xrange(len(argv)):
851852
if argv[i] == "-hh":
852853
argv[i] = "-h"
854+
elif re.match(r"\A\d+!\Z", argv[i]) and argv[max(0, i - 1)] == "--threads" or re.match(r"\A--threads.+\d+!\Z", argv[i]):
855+
argv[i] = argv[i][:-1]
856+
conf.skipThreadCheck = True
853857
elif argv[i] == "--version":
854858
print VERSION_STRING.split('/')[-1]
855859
raise SystemExit

0 commit comments

Comments
 (0)