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

Skip to content

Commit 1c17967

Browse files
committed
Minor patching (--not-string related)
1 parent 7a6433b commit 1c17967

5 files changed

Lines changed: 27 additions & 12 deletions

File tree

extra/vulnserver/vulnserver.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,21 @@ def do_REQUEST(self):
147147
_cursor.execute("SELECT * FROM users WHERE id=%s LIMIT 0, 1" % self.params["id"])
148148
results = _cursor.fetchall()
149149

150-
output += "<b>SQL results:</b>\n"
151-
output += "<table border=\"1\">\n"
150+
output += "<b>SQL results:</b><br>\n"
152151

153-
for row in results:
154-
output += "<tr>"
155-
for value in row:
156-
output += "<td>%s</td>" % value
157-
output += "</tr>\n"
152+
if results:
153+
output += "<table border=\"1\">\n"
154+
155+
for row in results:
156+
output += "<tr>"
157+
for value in row:
158+
output += "<td>%s</td>" % value
159+
output += "</tr>\n"
160+
161+
output += "</table>\n"
162+
else:
163+
output += "no results found"
158164

159-
output += "</table>\n"
160165
output += "</body></html>"
161166
except Exception as ex:
162167
code = INTERNAL_SERVER_ERROR

lib/controller/checks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,9 @@ def _():
939939
if conf.string and any(conf.string in getUnicode(_) for _ in (randInt1, randInt2, randInt3)):
940940
continue
941941

942+
if conf.notString and any(conf.notString in getUnicode(_) for _ in (randInt1, randInt2, randInt3)):
943+
continue
944+
942945
if randInt3 > randInt2 > randInt1:
943946
break
944947

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
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.4.5.3"
21+
VERSION = "1.4.5.4"
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)

lib/core/testing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def vulnTest():
4848
("-r <request> --flush-session -v 5 --test-skip='heavy' --save=<tmp>", ("CloudFlare", "possible DBMS: 'SQLite'", "User-agent: foobar", "~Type: time-based blind")),
4949
("-l <log> --flush-session --keep-alive --skip-waf -v 5 --technique=U --union-from=users --banner --parse-errors", ("banner: '3.", "ORDER BY term out of range", "~xp_cmdshell", "Connection: keep-alive")),
5050
("-l <log> --offline --banner -v 5", ("banner: '3.", "~[TRAFFIC OUT]")),
51+
("-u <url> --flush-session --banner --technique=B --not-string 'no results'", ("banner: '3.",)),
5152
("-u <url> --flush-session --banner --technique=B --first=1 --last=2", ("banner: '3.'",)),
5253
("-u <url> --flush-session --encoding=ascii --forms --crawl=2 --threads=2 --banner", ("total of 2 targets", "might be injectable", "Type: UNION query", "banner: '3.")),
5354
("-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.")),

lib/request/comparison.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,19 @@ def _comparison(page, headers, code, getRatioValue, pageLength):
6363
if any((conf.string, conf.notString, conf.regexp)):
6464
rawResponse = "%s%s" % (listToStrValue(_ for _ in headers.headers if not _.startswith("%s:" % URI_HTTP_HEADER)) if headers else "", page)
6565

66-
# String to match in page when the query is True and/or valid
66+
# String to match in page when the query is True
6767
if conf.string:
6868
return conf.string in rawResponse
6969

70-
# String to match in page when the query is False and/or invalid
70+
# String to match in page when the query is False
7171
if conf.notString:
72-
return conf.notString not in rawResponse
72+
if conf.notString in rawResponse:
73+
return False
74+
else:
75+
if kb.errorIsNone and (wasLastResponseDBMSError() or wasLastResponseHTTPError()):
76+
return None
77+
else:
78+
return True
7379

7480
# Regular expression to match in page when the query is True and/or valid
7581
if conf.regexp:

0 commit comments

Comments
 (0)