mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Fixes #5018
This commit is contained in:
parent
0b775b6d1d
commit
a2fcab448c
|
@ -167,8 +167,27 @@ class WichmannHill(random.Random):
|
|||
|
||||
def patchHeaders(headers):
|
||||
if headers is not None and not hasattr(headers, "headers"):
|
||||
if isinstance(headers, dict):
|
||||
class _(dict):
|
||||
def __getitem__(self, key):
|
||||
for key_ in self:
|
||||
if key_.lower() == key.lower():
|
||||
return super(_, self).__getitem__(key_)
|
||||
|
||||
raise KeyError(key)
|
||||
|
||||
def get(self, key, default=None):
|
||||
try:
|
||||
return self[key]
|
||||
except KeyError:
|
||||
return default
|
||||
|
||||
headers = _(headers)
|
||||
|
||||
headers.headers = ["%s: %s\r\n" % (header, headers[header]) for header in headers]
|
||||
|
||||
return headers
|
||||
|
||||
def cmp(a, b):
|
||||
"""
|
||||
>>> cmp("a", "b")
|
||||
|
|
|
@ -20,7 +20,7 @@ from thirdparty import six
|
|||
from thirdparty.six import unichr as _unichr
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.6.3.5"
|
||||
VERSION = "1.6.3.6"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
@ -642,7 +642,7 @@ class Connect(object):
|
|||
if hasattr(conn, "redurl"):
|
||||
responseHeaders[HTTP_HEADER.LOCATION] = conn.redurl
|
||||
|
||||
patchHeaders(responseHeaders)
|
||||
responseHeaders = patchHeaders(responseHeaders)
|
||||
kb.serverHeader = responseHeaders.get(HTTP_HEADER.SERVER, kb.serverHeader)
|
||||
else:
|
||||
code = None
|
||||
|
@ -724,7 +724,7 @@ class Connect(object):
|
|||
page = ex.read() if not skipRead else None
|
||||
responseHeaders = ex.info()
|
||||
responseHeaders[URI_HTTP_HEADER] = ex.geturl()
|
||||
patchHeaders(responseHeaders)
|
||||
responseHeaders = patchHeaders(responseHeaders)
|
||||
page = decodePage(page, responseHeaders.get(HTTP_HEADER.CONTENT_ENCODING), responseHeaders.get(HTTP_HEADER.CONTENT_TYPE), percentDecode=not crawling)
|
||||
except socket.timeout:
|
||||
warnMsg = "connection timed out while trying "
|
||||
|
@ -1535,7 +1535,7 @@ class Connect(object):
|
|||
kb.permissionFlag = True
|
||||
singleTimeWarnMessage("potential permission problems detected ('%s')" % message)
|
||||
|
||||
patchHeaders(headers)
|
||||
headers = patchHeaders(headers)
|
||||
|
||||
if content or response:
|
||||
return page, headers, code
|
||||
|
|
Loading…
Reference in New Issue
Block a user