From c5138d4696b13c208d0b4c45fe89fc626d4cfe0d Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 21 Apr 2015 00:02:47 +0200 Subject: [PATCH] Minor refactoring --- lib/core/option.py | 12 ++++++------ lib/core/optiondict.py | 6 +++--- lib/parse/cmdline.py | 6 +++--- lib/request/connect.py | 6 +++--- sqlmap.conf | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index 49d7f2f1e..463557108 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -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) diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 6ce23da37..da71e84c1 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -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", diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 6af59e646..9a9787adb 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -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", diff --git a/lib/request/connect.py b/lib/request/connect.py index e412bd3f1..3321b9d85 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -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() diff --git a/sqlmap.conf b/sqlmap.conf index b23c58b11..498c3d3e8 100644 --- a/sqlmap.conf +++ b/sqlmap.conf @@ -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