Minor refactoring

This commit is contained in:
Miroslav Stampar 2015-04-21 00:02:47 +02:00
parent 349dfbf2ae
commit c5138d4696
5 changed files with 18 additions and 18 deletions

View File

@ -1140,16 +1140,16 @@ def _setSafeUrl():
"""
Check and set the safe URL options.
"""
if not conf.safUrl:
if not conf.safeUrl:
return
if not re.search("^http[s]*://", conf.safUrl):
if ":443/" in conf.safUrl:
conf.safUrl = "https://" + conf.safUrl
if not re.search("^http[s]*://", conf.safeUrl):
if ":443/" in conf.safeUrl:
conf.safeUrl = "https://" + conf.safeUrl
else:
conf.safUrl = "http://" + conf.safUrl
conf.safeUrl = "http://" + conf.safeUrl
if conf.saFreq <= 0:
if conf.safeFreq <= 0:
errMsg = "please provide a valid value (>0) for safe frequency (--safe-freq) while using safe URL feature"
raise SqlmapSyntaxException(errMsg)

View File

@ -50,9 +50,9 @@ optDict = {
"timeout": "float",
"retries": "integer",
"rParam": "string",
"safUrl": "string",
"safPost": "string",
"saFreq": "integer",
"safeUrl": "string",
"safePost": "string",
"safeFreq": "integer",
"skipUrlEncode": "boolean",
"csrfToken": "string",
"csrfUrl": "string",

View File

@ -185,13 +185,13 @@ def cmdLineParser():
request.add_option("--randomize", dest="rParam",
help="Randomly change value for given parameter(s)")
request.add_option("--safe-url", dest="safUrl",
request.add_option("--safe-url", dest="safeUrl",
help="URL address to visit frequently during testing")
request.add_option("--safe-post", dest="safPost",
request.add_option("--safe-post", dest="safePost",
help="POST data to send to a safe URL")
request.add_option("--safe-freq", dest="saFreq", type="int",
request.add_option("--safe-freq", dest="safeFreq", type="int",
help="Test requests between two visits to a given safe URL")
request.add_option("--skip-urlencode", dest="skipUrlEncode",

View File

@ -971,10 +971,10 @@ class Connect(object):
warnMsg += "10 or more)"
logger.critical(warnMsg)
if conf.safUrl and conf.saFreq > 0:
if conf.safeUrl and conf.safeFreq > 0:
kb.queryCounter += 1
if kb.queryCounter % conf.saFreq == 0:
Connect.getPage(url=conf.safUrl, post=conf.safPost, cookie=cookie, direct=True, silent=True, ua=ua, referer=referer, host=host)
if kb.queryCounter % conf.safeFreq == 0:
Connect.getPage(url=conf.safeUrl, post=conf.safePost, cookie=cookie, direct=True, silent=True, ua=ua, referer=referer, host=host)
start = time.time()

View File

@ -150,16 +150,16 @@ rParam =
# URL address to visit frequently during testing.
# Example: http://192.168.1.121/index.html
safUrl =
safeUrl =
# POST data to send to a safe URL.
# Example: username=admin&password=passw0rd!
safPost =
safePost =
# Test requests between two visits to a given safe URL (default 0).
# Valid: integer
# Default: 0
saFreq = 0
safeFreq = 0
# Skip URL encoding of payload data
# Valid: True or False