mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 17:46:37 +03:00
Minor refactoring
This commit is contained in:
parent
349dfbf2ae
commit
c5138d4696
|
@ -1140,16 +1140,16 @@ def _setSafeUrl():
|
||||||
"""
|
"""
|
||||||
Check and set the safe URL options.
|
Check and set the safe URL options.
|
||||||
"""
|
"""
|
||||||
if not conf.safUrl:
|
if not conf.safeUrl:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not re.search("^http[s]*://", conf.safUrl):
|
if not re.search("^http[s]*://", conf.safeUrl):
|
||||||
if ":443/" in conf.safUrl:
|
if ":443/" in conf.safeUrl:
|
||||||
conf.safUrl = "https://" + conf.safUrl
|
conf.safeUrl = "https://" + conf.safeUrl
|
||||||
else:
|
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"
|
errMsg = "please provide a valid value (>0) for safe frequency (--safe-freq) while using safe URL feature"
|
||||||
raise SqlmapSyntaxException(errMsg)
|
raise SqlmapSyntaxException(errMsg)
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ optDict = {
|
||||||
"timeout": "float",
|
"timeout": "float",
|
||||||
"retries": "integer",
|
"retries": "integer",
|
||||||
"rParam": "string",
|
"rParam": "string",
|
||||||
"safUrl": "string",
|
"safeUrl": "string",
|
||||||
"safPost": "string",
|
"safePost": "string",
|
||||||
"saFreq": "integer",
|
"safeFreq": "integer",
|
||||||
"skipUrlEncode": "boolean",
|
"skipUrlEncode": "boolean",
|
||||||
"csrfToken": "string",
|
"csrfToken": "string",
|
||||||
"csrfUrl": "string",
|
"csrfUrl": "string",
|
||||||
|
|
|
@ -185,13 +185,13 @@ def cmdLineParser():
|
||||||
request.add_option("--randomize", dest="rParam",
|
request.add_option("--randomize", dest="rParam",
|
||||||
help="Randomly change value for given parameter(s)")
|
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")
|
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")
|
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")
|
help="Test requests between two visits to a given safe URL")
|
||||||
|
|
||||||
request.add_option("--skip-urlencode", dest="skipUrlEncode",
|
request.add_option("--skip-urlencode", dest="skipUrlEncode",
|
||||||
|
|
|
@ -971,10 +971,10 @@ class Connect(object):
|
||||||
warnMsg += "10 or more)"
|
warnMsg += "10 or more)"
|
||||||
logger.critical(warnMsg)
|
logger.critical(warnMsg)
|
||||||
|
|
||||||
if conf.safUrl and conf.saFreq > 0:
|
if conf.safeUrl and conf.safeFreq > 0:
|
||||||
kb.queryCounter += 1
|
kb.queryCounter += 1
|
||||||
if kb.queryCounter % conf.saFreq == 0:
|
if kb.queryCounter % conf.safeFreq == 0:
|
||||||
Connect.getPage(url=conf.safUrl, post=conf.safPost, cookie=cookie, direct=True, silent=True, ua=ua, referer=referer, host=host)
|
Connect.getPage(url=conf.safeUrl, post=conf.safePost, cookie=cookie, direct=True, silent=True, ua=ua, referer=referer, host=host)
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
|
|
|
@ -150,16 +150,16 @@ rParam =
|
||||||
|
|
||||||
# URL address to visit frequently during testing.
|
# URL address to visit frequently during testing.
|
||||||
# Example: http://192.168.1.121/index.html
|
# Example: http://192.168.1.121/index.html
|
||||||
safUrl =
|
safeUrl =
|
||||||
|
|
||||||
# POST data to send to a safe URL.
|
# POST data to send to a safe URL.
|
||||||
# Example: username=admin&password=passw0rd!
|
# Example: username=admin&password=passw0rd!
|
||||||
safPost =
|
safePost =
|
||||||
|
|
||||||
# Test requests between two visits to a given safe URL (default 0).
|
# Test requests between two visits to a given safe URL (default 0).
|
||||||
# Valid: integer
|
# Valid: integer
|
||||||
# Default: 0
|
# Default: 0
|
||||||
saFreq = 0
|
safeFreq = 0
|
||||||
|
|
||||||
# Skip URL encoding of payload data
|
# Skip URL encoding of payload data
|
||||||
# Valid: True or False
|
# Valid: True or False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user