mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Implements option --retry-on (#4876)
This commit is contained in:
parent
fc9875fc12
commit
9e17babe7b
|
@ -2648,6 +2648,13 @@ def _basicOptionValidation():
|
||||||
errMsg = "invalid regular expression '%s' ('%s')" % (conf.paramExclude, getSafeExString(ex))
|
errMsg = "invalid regular expression '%s' ('%s')" % (conf.paramExclude, getSafeExString(ex))
|
||||||
raise SqlmapSyntaxException(errMsg)
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
|
||||||
|
if conf.retryOn:
|
||||||
|
try:
|
||||||
|
re.compile(conf.retryOn)
|
||||||
|
except Exception as ex:
|
||||||
|
errMsg = "invalid regular expression '%s' ('%s')" % (conf.retryOn, getSafeExString(ex))
|
||||||
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
|
||||||
if conf.cookieDel and len(conf.cookieDel):
|
if conf.cookieDel and len(conf.cookieDel):
|
||||||
errMsg = "option '--cookie-del' should contain a single character (e.g. ';')"
|
errMsg = "option '--cookie-del' should contain a single character (e.g. ';')"
|
||||||
raise SqlmapSyntaxException(errMsg)
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
|
|
@ -54,6 +54,7 @@ optDict = {
|
||||||
"delay": "float",
|
"delay": "float",
|
||||||
"timeout": "float",
|
"timeout": "float",
|
||||||
"retries": "integer",
|
"retries": "integer",
|
||||||
|
"retryOn": "string",
|
||||||
"rParam": "string",
|
"rParam": "string",
|
||||||
"safeUrl": "string",
|
"safeUrl": "string",
|
||||||
"safePost": "string",
|
"safePost": "string",
|
||||||
|
|
|
@ -20,7 +20,7 @@ from thirdparty import six
|
||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.5.10.21"
|
VERSION = "1.5.11.0"
|
||||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
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)
|
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||||
|
|
|
@ -246,6 +246,9 @@ def cmdLineParser(argv=None):
|
||||||
request.add_argument("--retries", dest="retries", type=int,
|
request.add_argument("--retries", dest="retries", type=int,
|
||||||
help="Retries when the connection timeouts (default %d)" % defaults.retries)
|
help="Retries when the connection timeouts (default %d)" % defaults.retries)
|
||||||
|
|
||||||
|
request.add_argument("--retry-on", dest="retryOn",
|
||||||
|
help="Retry request on regexp matching content (e.g. \"drop\")")
|
||||||
|
|
||||||
request.add_argument("--randomize", dest="rParam",
|
request.add_argument("--randomize", dest="rParam",
|
||||||
help="Randomly change value for given parameter(s)")
|
help="Randomly change value for given parameter(s)")
|
||||||
|
|
||||||
|
|
|
@ -909,6 +909,17 @@ class Connect(object):
|
||||||
|
|
||||||
socket.setdefaulttimeout(conf.timeout)
|
socket.setdefaulttimeout(conf.timeout)
|
||||||
|
|
||||||
|
if conf.retryOn and re.search(conf.retryOn, page, re.I):
|
||||||
|
if threadData.retriesCount < conf.retries:
|
||||||
|
warnMsg = "forced retry of the request because of undesired page content"
|
||||||
|
logger.warn(warnMsg)
|
||||||
|
return Connect._retryProxy(**kwargs)
|
||||||
|
else:
|
||||||
|
errMsg = "unable to get the page content not matching "
|
||||||
|
errMsg += "the given regular expression '%s'. Please use as high " % conf.retryOn
|
||||||
|
errMsg += "value for option '--retries' as possible (e.g. 20 or more)"
|
||||||
|
raise SqlmapConnectionException(errMsg)
|
||||||
|
|
||||||
processResponse(page, responseHeaders, code, status)
|
processResponse(page, responseHeaders, code, status)
|
||||||
|
|
||||||
if not skipLogTraffic:
|
if not skipLogTraffic:
|
||||||
|
|
|
@ -160,6 +160,9 @@ timeout = 30
|
||||||
# Default: 3
|
# Default: 3
|
||||||
retries = 3
|
retries = 3
|
||||||
|
|
||||||
|
# Retry request on regexp matching content.
|
||||||
|
retries = 3
|
||||||
|
|
||||||
# Randomly change value for the given parameter.
|
# Randomly change value for the given parameter.
|
||||||
rParam =
|
rParam =
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user