Skip to content

Commit 1b2ac30

Browse files
committed
Implementing --proxy-freq (Issue #4496)
1 parent bb02eef commit 1b2ac30

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

lib/core/option.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,6 +2714,10 @@ def _basicOptionValidation():
27142714
errMsg = "switch '--proxy' is incompatible with option '--proxy-file'"
27152715
raise SqlmapSyntaxException(errMsg)
27162716

2717+
if conf.proxyFreq and not conf.proxyFile:
2718+
errMsg = "option '--proxy-freq' requires usage of option '--proxy-file'"
2719+
raise SqlmapSyntaxException(errMsg)
2720+
27172721
if conf.checkTor and not any((conf.tor, conf.proxy)):
27182722
errMsg = "switch '--check-tor' requires usage of switch '--tor' (or option '--proxy' with HTTP proxy address of Tor service)"
27192723
raise SqlmapSyntaxException(errMsg)

lib/core/optiondict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"proxy": "string",
4747
"proxyCred": "string",
4848
"proxyFile": "string",
49+
"proxyFreq": "integer",
4950
"tor": "boolean",
5051
"torPort": "integer",
5152
"torType": "string",

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.4.12.36"
21+
VERSION = "1.4.12.37"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/parse/cmdline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ def cmdLineParser(argv=None):
222222
request.add_argument("--proxy-file", dest="proxyFile",
223223
help="Load proxy list from a file")
224224

225+
request.add_argument("--proxy-freq", dest="proxyFreq", type=int,
226+
help="Requests between change of proxy from a given list")
227+
225228
request.add_argument("--tor", dest="tor", action="store_true",
226229
help="Use Tor anonymity network")
227230

lib/request/connect.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,15 @@ def getPage(**kwargs):
285285
kb.requestCounter += 1
286286
threadData.lastRequestUID = kb.requestCounter
287287

288+
if conf.proxyFreq:
289+
if kb.requestCounter % conf.proxyFreq == 1:
290+
conf.proxy = None
291+
292+
warnMsg = "changing proxy"
293+
logger.warn(warnMsg)
294+
295+
setHTTPHandlers()
296+
288297
if conf.dummy or conf.murphyRate and randomInt() % conf.murphyRate == 0:
289298
if conf.murphyRate:
290299
time.sleep(randomInt() % (MAX_MURPHY_SLEEP_TIME + 1))

0 commit comments

Comments
 (0)