mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-11-20 07:00:25 +00:00
Fix for --http2 not storing/sending cookies (Set-Cookie)
This commit is contained in:
parent
04f0987e81
commit
2de056aa14
3 changed files with 17 additions and 1 deletions
|
|
@ -19,7 +19,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.11.67"
|
||||
VERSION = "1.10.11.68"
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -745,11 +745,26 @@ class Connect(object):
|
|||
except ValueError:
|
||||
raise SqlmapMissingDependence("native HTTP/2 client does not support SOCKS proxies (omit '--http2' or use an HTTP proxy)")
|
||||
|
||||
# Note: cookie jar handling (i.e. Set-Cookie), as urllib's HTTPCookieProcessor is bypassed
|
||||
if conf.cj is not None and HTTP_HEADER.COOKIE not in headers:
|
||||
try:
|
||||
conf.cj.add_cookie_header(req)
|
||||
if req.get_header(HTTP_HEADER.COOKIE):
|
||||
headers[HTTP_HEADER.COOKIE] = req.get_header(HTTP_HEADER.COOKIE)
|
||||
except Exception as ex:
|
||||
logger.debug("problem occurred while adding HTTP/2 cookies ('%s')" % getSafeExString(ex))
|
||||
|
||||
try:
|
||||
conn = http2OpenUrl(url, method or (HTTPMETHOD.POST if post is not None else HTTPMETHOD.GET), headers, post, timeout, follow_redirects=kb.choices.redirect != REDIRECTION.NO and not conf.ignoreRedirects, proxy=h2proxy, sensitive_headers=tuple(kb.authRefreshHeaders) if conf.authRefresh else ())
|
||||
except IOError as ex:
|
||||
raise _http_client.HTTPException(getSafeExString(ex))
|
||||
else:
|
||||
if conf.cj is not None:
|
||||
try:
|
||||
conf.cj.extract_cookies(conn, req)
|
||||
except Exception as ex:
|
||||
logger.debug("problem occurred while storing HTTP/2 cookies ('%s')" % getSafeExString(ex))
|
||||
|
||||
if conn.code >= 400:
|
||||
raise _urllib.error.HTTPError(conn.geturl(), conn.code, conn.msg, conn.info(), io.BytesIO(conn.read()))
|
||||
|
||||
|
|
|
|||
|
|
@ -1496,6 +1496,7 @@ class H2Response(object):
|
|||
if not name.startswith(":"):
|
||||
self._info[name] = value
|
||||
self._info.headers = ["%s: %s\r\n" % item for item in self._info.items()]
|
||||
self._info.getheaders = lambda name: self._info.get_all(name) or [] # Note: Python 2 cookielib's interface (e.g. for Set-Cookie)
|
||||
|
||||
def info(self):
|
||||
return self._info
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue