mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-26 09:29:02 +00:00
Minor fixes for --http2 (#4402)
This commit is contained in:
@@ -1175,7 +1175,7 @@ def _setHTTPHandlers():
|
||||
proxyString = ""
|
||||
|
||||
proxyString += "%s:%d" % (hostname, port)
|
||||
proxyHandler.proxies = {"http": proxyString, "https": proxyString}
|
||||
proxyHandler.proxies = kb.proxies = {"http": proxyString, "https": proxyString}
|
||||
|
||||
proxyHandler.__init__(proxyHandler.proxies)
|
||||
|
||||
@@ -2151,6 +2151,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
||||
kb.previousMethod = None
|
||||
kb.processNonCustom = None
|
||||
kb.processUserMarks = None
|
||||
kb.proxies = None
|
||||
kb.proxyAuthHeader = None
|
||||
kb.queryCounter = 0
|
||||
kb.randomPool = {}
|
||||
|
||||
@@ -19,7 +19,7 @@ from lib.core.enums import OS
|
||||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.9.2.10"
|
||||
VERSION = "1.9.2.11"
|
||||
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)
|
||||
|
||||
@@ -615,10 +615,15 @@ class Connect(object):
|
||||
if conf.http2:
|
||||
try:
|
||||
import httpx
|
||||
with httpx.Client(verify=False, http2=True, timeout=timeout, follow_redirects=True, cookies=conf.cj) as client:
|
||||
conn = client.request(method or (HTTPMETHOD.POST if post is not None else HTTPMETHOD.GET), url, headers=headers, data=post)
|
||||
except ImportError:
|
||||
raise SqlmapMissingDependence("httpx[http2] not available (e.g. 'pip%s install httpx[http2]')" % ('3' if six.PY3 else ""))
|
||||
|
||||
try:
|
||||
proxy_mounts = dict(("%s://" % key, httpx.HTTPTransport(proxy="%s%s" % ("http://" if not "://" in kb.proxies[key] else "", kb.proxies[key]))) for key in kb.proxies) if kb.proxies else None
|
||||
with httpx.Client(verify=False, http2=True, timeout=timeout, follow_redirects=True, cookies=conf.cj, mounts=proxy_mounts) as client:
|
||||
conn = client.request(method or (HTTPMETHOD.POST if post is not None else HTTPMETHOD.GET), url, headers=headers, data=post)
|
||||
except httpx.ConnectError as ex:
|
||||
raise _http_client.HTTPException(getSafeExString(ex))
|
||||
else:
|
||||
conn.code = conn.status_code
|
||||
conn.msg = conn.reason_phrase
|
||||
|
||||
Reference in New Issue
Block a user