diff --git a/lib/core/option.py b/lib/core/option.py index 0776c7a11..83152fc6f 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -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) diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 103cbef6c..b13d1a3e5 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -46,6 +46,7 @@ optDict = { "proxy": "string", "proxyCred": "string", "proxyFile": "string", + "proxyFreq": "integer", "tor": "boolean", "torPort": "integer", "torType": "string", diff --git a/lib/core/settings.py b/lib/core/settings.py index 5d1c7a973..ccf81c467 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -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) diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index a7da0c320..aa2910b58 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -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") diff --git a/lib/request/connect.py b/lib/request/connect.py index 4f64d075f..ef01dd83b 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -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))