mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 13:03:50 +03:00
adding some constraining to number of used threads on brute force switches together with a warning in case of connection exception(s) with --threads>1
This commit is contained in:
parent
49b925772b
commit
22a1870c2c
|
@ -96,6 +96,7 @@ class HTTPHEADER:
|
||||||
class WARNFLAGS:
|
class WARNFLAGS:
|
||||||
RANDOM_AGENT = 'randomAgent'
|
RANDOM_AGENT = 'randomAgent'
|
||||||
DATA_TO_STDOUT = 'dataToStdout'
|
DATA_TO_STDOUT = 'dataToStdout'
|
||||||
|
THREADS = 'threads'
|
||||||
|
|
||||||
class EXPECTED:
|
class EXPECTED:
|
||||||
BOOL = "bool"
|
BOOL = "bool"
|
||||||
|
|
|
@ -390,6 +390,10 @@ class Connect:
|
||||||
warnMsg += "with the --random-agent switch turned on "
|
warnMsg += "with the --random-agent switch turned on "
|
||||||
warnMsg += "and/or try to use proxy switches (--ignore-proxy, --proxy,...)"
|
warnMsg += "and/or try to use proxy switches (--ignore-proxy, --proxy,...)"
|
||||||
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.RANDOM_AGENT)
|
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.RANDOM_AGENT)
|
||||||
|
elif conf.threads > 1:
|
||||||
|
warnMsg = "if the problem persists please try to lower "
|
||||||
|
warnMsg += "the number of used threads (--threads)"
|
||||||
|
singleTimeLogMessage(warnMsg, logging.WARN, WARNFLAGS.THREADS)
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ from lib.core.data import logger
|
||||||
from lib.core.enums import DBMS
|
from lib.core.enums import DBMS
|
||||||
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
from lib.core.exception import sqlmapMissingMandatoryOptionException
|
||||||
from lib.core.exception import sqlmapThreadException
|
from lib.core.exception import sqlmapThreadException
|
||||||
|
from lib.core.settings import MAX_NUMBER_OF_THREADS
|
||||||
from lib.core.settings import METADB_SUFFIX
|
from lib.core.settings import METADB_SUFFIX
|
||||||
from lib.core.session import safeFormatString
|
from lib.core.session import safeFormatString
|
||||||
from lib.request import inject
|
from lib.request import inject
|
||||||
|
@ -100,10 +101,16 @@ def tableExists(tableFile, regex=None):
|
||||||
infoMsg = "starting %d threads" % conf.threads
|
infoMsg = "starting %d threads" % conf.threads
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
else:
|
else:
|
||||||
|
while True:
|
||||||
message = "please enter number of threads? [Enter for %d (current)] " % conf.threads
|
message = "please enter number of threads? [Enter for %d (current)] " % conf.threads
|
||||||
choice = readInput(message, default=str(conf.threads))
|
choice = readInput(message, default=str(conf.threads))
|
||||||
if choice and choice.isdigit():
|
if choice and choice.isdigit():
|
||||||
|
if int(choice) > MAX_NUMBER_OF_THREADS:
|
||||||
|
errMsg = "maximum number of used threads is %d avoiding possible connection issues" % MAX_NUMBER_OF_THREADS
|
||||||
|
logger.critical(errMsg)
|
||||||
|
else:
|
||||||
conf.threads = int(choice)
|
conf.threads = int(choice)
|
||||||
|
break
|
||||||
|
|
||||||
if conf.threads == 1:
|
if conf.threads == 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."
|
||||||
|
@ -218,10 +225,16 @@ def columnExists(columnFile, regex=None):
|
||||||
infoMsg = "starting %d threads" % conf.threads
|
infoMsg = "starting %d threads" % conf.threads
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
else:
|
else:
|
||||||
|
while True:
|
||||||
message = "please enter number of threads? [Enter for %d (current)] " % conf.threads
|
message = "please enter number of threads? [Enter for %d (current)] " % conf.threads
|
||||||
choice = readInput(message, default=str(conf.threads))
|
choice = readInput(message, default=str(conf.threads))
|
||||||
if choice and choice.isdigit():
|
if choice and choice.isdigit():
|
||||||
|
if int(choice) > MAX_NUMBER_OF_THREADS:
|
||||||
|
errMsg = "maximum number of used threads is %d avoiding possible connection issues" % MAX_NUMBER_OF_THREADS
|
||||||
|
logger.critical(errMsg)
|
||||||
|
else:
|
||||||
conf.threads = int(choice)
|
conf.threads = int(choice)
|
||||||
|
break
|
||||||
|
|
||||||
if conf.threads == 1:
|
if conf.threads == 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."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user