From 349dfbf2ae703e6ce3c86dbc355966becf6373fa Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 20 Apr 2015 23:55:59 +0200 Subject: [PATCH] Adding an option --safe-post --- .gitattributes | 1 + lib/core/optiondict.py | 1 + lib/parse/cmdline.py | 3 +++ lib/request/connect.py | 3 +-- sqlmap.conf | 4 ++++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 8b6e58fe0..a6b6a3526 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ *.py text eol=lf +*.conf text eol=lf *_ binary *.dll binary diff --git a/lib/core/optiondict.py b/lib/core/optiondict.py index 355238464..6ce23da37 100644 --- a/lib/core/optiondict.py +++ b/lib/core/optiondict.py @@ -51,6 +51,7 @@ optDict = { "retries": "integer", "rParam": "string", "safUrl": "string", + "safPost": "string", "saFreq": "integer", "skipUrlEncode": "boolean", "csrfToken": "string", diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 3c1620912..6af59e646 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -188,6 +188,9 @@ def cmdLineParser(): request.add_option("--safe-url", dest="safUrl", help="URL address to visit frequently during testing") + request.add_option("--safe-post", dest="safPost", + help="POST data to send to a safe URL") + request.add_option("--safe-freq", dest="saFreq", type="int", help="Test requests between two visits to a given safe URL") diff --git a/lib/request/connect.py b/lib/request/connect.py index 51a187bbc..e412bd3f1 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -971,11 +971,10 @@ class Connect(object): warnMsg += "10 or more)" logger.critical(warnMsg) - if conf.safUrl and conf.saFreq > 0: kb.queryCounter += 1 if kb.queryCounter % conf.saFreq == 0: - Connect.getPage(url=conf.safUrl, cookie=cookie, direct=True, silent=True, ua=ua, referer=referer, host=host) + Connect.getPage(url=conf.safUrl, post=conf.safPost, cookie=cookie, direct=True, silent=True, ua=ua, referer=referer, host=host) start = time.time() diff --git a/sqlmap.conf b/sqlmap.conf index c3bae6b57..b23c58b11 100644 --- a/sqlmap.conf +++ b/sqlmap.conf @@ -152,6 +152,10 @@ rParam = # Example: http://192.168.1.121/index.html safUrl = +# POST data to send to a safe URL. +# Example: username=admin&password=passw0rd! +safPost = + # Test requests between two visits to a given safe URL (default 0). # Valid: integer # Default: 0