Implementing --proxy-freq (Issue #4496)

This commit is contained in:
Miroslav Stampar 2020-12-26 23:04:48 +01:00
parent bb02eefb70
commit 1b2ac3069d
5 changed files with 18 additions and 1 deletions

View File

@ -2714,6 +2714,10 @@ def _basicOptionValidation():
errMsg = "switch '--proxy' is incompatible with option '--proxy-file'"
raise SqlmapSyntaxException(errMsg)
if conf.proxyFreq and not conf.proxyFile:
errMsg = "option '--proxy-freq' requires usage of option '--proxy-file'"
raise SqlmapSyntaxException(errMsg)
if conf.checkTor and not any((conf.tor, conf.proxy)):
errMsg = "switch '--check-tor' requires usage of switch '--tor' (or option '--proxy' with HTTP proxy address of Tor service)"
raise SqlmapSyntaxException(errMsg)

View File

@ -46,6 +46,7 @@ optDict = {
"proxy": "string",
"proxyCred": "string",
"proxyFile": "string",
"proxyFreq": "integer",
"tor": "boolean",
"torPort": "integer",
"torType": "string",

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.4.12.36"
VERSION = "1.4.12.37"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -222,6 +222,9 @@ def cmdLineParser(argv=None):
request.add_argument("--proxy-file", dest="proxyFile",
help="Load proxy list from a file")
request.add_argument("--proxy-freq", dest="proxyFreq", type=int,
help="Requests between change of proxy from a given list")
request.add_argument("--tor", dest="tor", action="store_true",
help="Use Tor anonymity network")

View File

@ -285,6 +285,15 @@ class Connect(object):
kb.requestCounter += 1
threadData.lastRequestUID = kb.requestCounter
if conf.proxyFreq:
if kb.requestCounter % conf.proxyFreq == 1:
conf.proxy = None
warnMsg = "changing proxy"
logger.warn(warnMsg)
setHTTPHandlers()
if conf.dummy or conf.murphyRate and randomInt() % conf.murphyRate == 0:
if conf.murphyRate:
time.sleep(randomInt() % (MAX_MURPHY_SLEEP_TIME + 1))