Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 47d2cf0

Browse files
committed
Some more tests
1 parent ce65733 commit 47d2cf0

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

lib/core/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.11.107"
21+
VERSION = "1.3.11.108"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@@ -382,7 +382,7 @@
382382
BURP_REQUEST_REGEX = r"={10,}\s+([A-Z]{3,} .+?)\s+={10,}"
383383

384384
# Regex used for parsing XML Burp saved history items
385-
BURP_XML_HISTORY_REGEX = r'<port>(\d+)</port>.+?<request base64="true"><!\[CDATA\[([^]]+)'
385+
BURP_XML_HISTORY_REGEX = r'<port>(\d+)</port>.*?<request base64="true"><!\[CDATA\[([^]]+)'
386386

387387
# Encoding used for Unicode data
388388
UNICODE_ENCODING = "utf8"

lib/core/testing.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from lib.core.common import shellExec
3434
from lib.core.compat import round
3535
from lib.core.compat import xrange
36+
from lib.core.convert import encodeBase64
3637
from lib.core.convert import getUnicode
3738
from lib.core.data import conf
3839
from lib.core.data import kb
@@ -64,10 +65,13 @@ def vulnTest():
6465
"""
6566

6667
TESTS = (
67-
("-r <request> --flush-session", ("CloudFlare",)),
68-
("-u <url> --flush-session --encoding=ascii --forms --crawl=2 --banner", ("total of 2 targets", "might be injectable", "Type: UNION query", "banner: '3")),
68+
("--list-tampers", ("between", "MySQL", "xforwardedfor")),
69+
("-r <request> --flush-session", ("CloudFlare", "possible DBMS: 'SQLite'")),
70+
("-l <log> --flush-session --skip-waf -v 3 --technique=U --union-from=users --banner --parse-errors", ("banner: '3", "ORDER BY term out of range", "~xp_cmdshell")),
71+
("-l <log> --offline --banner -v 5", ("banner: '3", "~[TRAFFIC OUT]")),
72+
("-u <url> --flush-session --encoding=ascii --forms --crawl=2 --threads=2 --banner", ("total of 2 targets", "might be injectable", "Type: UNION query", "banner: '3")),
6973
("-u <url> --flush-session --data='{\"id\": 1}' --banner", ("might be injectable", "3 columns", "Payload: {\"id\"", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "banner: '3")),
70-
("-u <url> --flush-session --data='<root><param name=\"id\" value=\"1*\"/></root>' --union-char=1 --mobile --banner --smart", ("might be injectable", "Payload: <root><param name=\"id\" value=\"1", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "banner: '3")),
74+
("-u <url> --flush-session --data='<root><param name=\"id\" value=\"1*\"/></root>' --union-char=1 --mobile --answers='smartphone=3' --banner --smart -v 5", ("might be injectable", "Payload: <root><param name=\"id\" value=\"1", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "banner: '3", "Nexus")),
7175
("-u <url> --flush-session --method=PUT --data='a=1&b=2&c=3&id=1' --skip-static --dump -T users --start=1 --stop=2", ("might be injectable", "Parameter: id (PUT)", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", "2 entries")),
7276
("-u <url> --flush-session -H 'id: 1*' --tables", ("might be injectable", "Parameter: id #1* ((custom) HEADER)", "Type: boolean-based blind", "Type: time-based blind", "Type: UNION query", " users ")),
7377
("-u <url> --flush-session --banner --invalid-logical --technique=B --test-filter='OR boolean' --tamper=space2dash", ("banner: '3", " LIKE ")),
@@ -113,7 +117,13 @@ def _thread():
113117
handle, request = tempfile.mkstemp(suffix=".req")
114118
os.close(handle)
115119

116-
open(request, "w+").write("POST / HTTP/1.0\nHost: %s:%s\n\nid=1\n" % (address, port))
120+
handle, log = tempfile.mkstemp(suffix=".log")
121+
os.close(handle)
122+
123+
content = "POST / HTTP/1.0\nHost: %s:%s\n\nid=1\n" % (address, port)
124+
125+
open(request, "w+").write(content)
126+
open(log, "w+").write('<port>%d</port><request base64="true"><![CDATA[%s]]></request>' % (port, encodeBase64(content, binary=False)))
117127

118128
url = "http://%s:%d/?id=1" % (address, port)
119129
direct = "sqlite3://%s" % database
@@ -122,10 +132,10 @@ def _thread():
122132
status = '%d/%d (%d%%) ' % (count, len(TESTS), round(100.0 * count / len(TESTS)))
123133
dataToStdout("\r[%s] [INFO] complete: %s" % (time.strftime("%X"), status))
124134

125-
cmd = "%s %s %s --batch" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options.replace("<url>", url).replace("<direct>", direct).replace("<request>", request))
135+
cmd = "%s %s %s --batch" % (sys.executable, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "sqlmap.py")), options.replace("<url>", url).replace("<direct>", direct).replace("<request>", request).replace("<log>", log))
126136
output = shellExec(cmd)
127137

128-
if not all(check in output for check in checks):
138+
if not all((check in output if not check.startswith('~') else check[1:] not in output) for check in checks):
129139
dataToStdout("---\n\n$ %s\n" % cmd)
130140
dataToStdout("%s---\n" % clearColors(output))
131141
retVal = False

0 commit comments

Comments
 (0)