Skip to content

Commit fd36250

Browse files
committed
Proper fix for an Issue sqlmapproject#757
1 parent 2a26819 commit fd36250

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/core/enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ class HTTP_HEADER:
173173
SERVER = "Server"
174174
USER_AGENT = "User-Agent"
175175
TRANSFER_ENCODING = "Transfer-Encoding"
176+
URI = "URI"
176177
VIA = "Via"
177178

178179
class EXPECTED:

lib/techniques/error/use.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from lib.core.data import queries
3636
from lib.core.dicts import FROM_DUMMY_TABLE
3737
from lib.core.enums import DBMS
38+
from lib.core.enums import HTTP_HEADER
3839
from lib.core.settings import CHECK_ZERO_COLUMNS_THRESHOLD
3940
from lib.core.settings import MYSQL_ERROR_CHUNK_LENGTH
4041
from lib.core.settings import MSSQL_ERROR_CHUNK_LENGTH
@@ -99,14 +100,14 @@ def _oneShotErrorUse(expression, field=None):
99100

100101
incrementCounter(kb.technique)
101102

102-
if page and conf.noCast:
103+
if page and conf.noEscape:
103104
page = re.sub(r"('|\%%27)%s('|\%%27).*?('|\%%27)%s('|\%%27)" % (kb.chars.start, kb.chars.stop), "", page)
104105

105106
# Parse the returned page to get the exact error-based
106107
# SQL injection output
107108
output = reduce(lambda x, y: x if x is not None else y, (\
108109
extractRegexResult(check, page, re.DOTALL | re.IGNORECASE), \
109-
extractRegexResult(check, listToStrValue(headers.headers \
110+
extractRegexResult(check, listToStrValue([headers[header] for header in headers if header.lower() != HTTP_HEADER.URI.lower()] \
110111
if headers else None), re.DOTALL | re.IGNORECASE), \
111112
extractRegexResult(check, threadData.lastRedirectMsg[1] \
112113
if threadData.lastRedirectMsg and threadData.lastRedirectMsg[0] == \
@@ -117,7 +118,7 @@ def _oneShotErrorUse(expression, field=None):
117118
output = getUnicode(output)
118119
else:
119120
trimmed = extractRegexResult(trimcheck, page, re.DOTALL | re.IGNORECASE) \
120-
or extractRegexResult(trimcheck, listToStrValue(headers.headers \
121+
or extractRegexResult(trimcheck, listToStrValue([headers[header] for header in headers if header.lower() != HTTP_HEADER.URI.lower()] \
121122
if headers else None), re.DOTALL | re.IGNORECASE) \
122123
or extractRegexResult(trimcheck, threadData.lastRedirectMsg[1] \
123124
if threadData.lastRedirectMsg and threadData.lastRedirectMsg[0] == \

0 commit comments

Comments
 (0)