Skip to content

Commit eda669e

Browse files
committed
Fixes #5216
1 parent c382321 commit eda669e

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

lib/core/compat.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def __hash__(self):
278278
buffer = buffer
279279

280280
try:
281-
from pkg_resources import parse_version as LooseVersion
281+
from packaging import version
282+
LooseVersion = version.parse
282283
except ImportError:
283284
from distutils.version import LooseVersion

lib/core/option.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2166,7 +2166,6 @@ def _setKnowledgeBaseAttributes(flushAll=True):
21662166
kb.testType = None
21672167
kb.threadContinue = True
21682168
kb.threadException = False
2169-
kb.tlsSNI = {}
21702169
kb.uChar = NULL
21712170
kb.udfFail = False
21722171
kb.unionDuplicates = False

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty.six import unichr as _unichr
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.6.10.8"
23+
VERSION = "1.6.11.2"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/httpshandler.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,21 @@ def create_sock():
6363

6464
# Reference(s): https://docs.python.org/2/library/ssl.html#ssl.SSLContext
6565
# https://www.mnot.net/blog/2014/12/27/python_2_and_tls_sni
66-
if re.search(r"\A[\d.]+\Z", self.host or "") is None and kb.tlsSNI.get(self.host) is not False and hasattr(ssl, "SSLContext"):
66+
if hasattr(ssl, "SSLContext"):
6767
for protocol in (_ for _ in _protocols if _ >= ssl.PROTOCOL_TLSv1):
6868
try:
6969
sock = create_sock()
7070
if protocol not in _contexts:
7171
_contexts[protocol] = ssl.SSLContext(protocol)
72+
if self.cert_file and self.key_file:
73+
_contexts[protocol].load_cert_chain(certfile=self.cert_file, keyfile=self.key_file)
7274
try:
7375
# Reference(s): https://askubuntu.com/a/1263098
7476
# https://askubuntu.com/a/1250807
7577
_contexts[protocol].set_ciphers("DEFAULT@SECLEVEL=1")
7678
except ssl.SSLError:
7779
pass
78-
result = _contexts[protocol].wrap_socket(sock, do_handshake_on_connect=True, server_hostname=self.host)
80+
result = _contexts[protocol].wrap_socket(sock, do_handshake_on_connect=True, server_hostname=self.host if re.search(r"\A[\d.]+\Z", self.host or "") is None else None)
7981
if result:
8082
success = True
8183
self.sock = result
@@ -88,14 +90,11 @@ def create_sock():
8890
self._tunnel_host = None
8991
logger.debug("SSL connection error occurred for '%s' ('%s')" % (_lut[protocol], getSafeExString(ex)))
9092

91-
if kb.tlsSNI.get(self.host) is None:
92-
kb.tlsSNI[self.host] = success
93-
94-
if not success:
93+
elif hasattr(ssl, "wrap_socket"):
9594
for protocol in _protocols:
9695
try:
9796
sock = create_sock()
98-
_ = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=protocol)
97+
_ = ssl.wrap_socket(sock, keyfile=self.key_file, certfile=self.cert_file, ssl_version=protocol)
9998
if _:
10099
success = True
101100
self.sock = _

0 commit comments

Comments
 (0)