mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-02 20:54:13 +03:00
Fixes #1574
This commit is contained in:
parent
d5e6be41db
commit
b5b3411f16
|
@ -1897,7 +1897,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
|
||||||
kb.safeReq = AttribDict()
|
kb.safeReq = AttribDict()
|
||||||
kb.singleLogFlags = set()
|
kb.singleLogFlags = set()
|
||||||
kb.reduceTests = None
|
kb.reduceTests = None
|
||||||
kb.tlsSNI = None
|
kb.tlsSNI = {}
|
||||||
kb.stickyDBMS = False
|
kb.stickyDBMS = False
|
||||||
kb.stickyLevel = None
|
kb.stickyLevel = None
|
||||||
kb.storeCrawlingChoice = None
|
kb.storeCrawlingChoice = None
|
||||||
|
|
|
@ -45,12 +45,12 @@ class HTTPSConnection(httplib.HTTPSConnection):
|
||||||
|
|
||||||
# Reference(s): https://docs.python.org/2/library/ssl.html#ssl.SSLContext
|
# Reference(s): https://docs.python.org/2/library/ssl.html#ssl.SSLContext
|
||||||
# https://www.mnot.net/blog/2014/12/27/python_2_and_tls_sni
|
# https://www.mnot.net/blog/2014/12/27/python_2_and_tls_sni
|
||||||
if kb.tlsSNI != False and hasattr(ssl, "SSLContext"):
|
if kb.tlsSNI.get(self.host) != False and hasattr(ssl, "SSLContext"):
|
||||||
for protocol in filter(lambda _: _ >= ssl.PROTOCOL_TLSv1, _protocols):
|
for protocol in filter(lambda _: _ >= ssl.PROTOCOL_TLSv1, _protocols):
|
||||||
try:
|
try:
|
||||||
sock = create_sock()
|
sock = create_sock()
|
||||||
context = ssl.SSLContext(protocol)
|
context = ssl.SSLContext(protocol)
|
||||||
_ = context.wrap_socket(sock, do_handshake_on_connect=False, server_hostname=self.host)
|
_ = context.wrap_socket(sock, do_handshake_on_connect=True, server_hostname=self.host)
|
||||||
if _:
|
if _:
|
||||||
success = True
|
success = True
|
||||||
self.sock = _
|
self.sock = _
|
||||||
|
@ -63,8 +63,8 @@ class HTTPSConnection(httplib.HTTPSConnection):
|
||||||
self._tunnel_host = None
|
self._tunnel_host = None
|
||||||
logger.debug("SSL connection error occurred ('%s')" % getSafeExString(ex))
|
logger.debug("SSL connection error occurred ('%s')" % getSafeExString(ex))
|
||||||
|
|
||||||
if kb.tlsSNI is None:
|
if kb.tlsSNI.get(self.host) is None:
|
||||||
kb.tlsSNI = success
|
kb.tlsSNI[self.host] = success
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
for protocol in _protocols:
|
for protocol in _protocols:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user