Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05f2e17

Browse files
committed
Fixes #6006
1 parent 636c12b commit 05f2e17

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

data/txt/sha256sums.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ e18c0c2c5a57924a623792a48bfd36e98d9bc085f6db61a95fc0dc8a3bcedc0c lib/core/decor
189189
48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py
190190
3574639db4942d16a2dc0a2f04bb7c0913c40c3862b54d34c44075a760e0c194 lib/core/revision.py
191191
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
192-
c0f848d501c33ae35d0372c7d70ce9bde176691b6962ae94e2d753c2fff17543 lib/core/settings.py
192+
6cae0d283ebb2e5860f2ea19b2c224b8e22f53b8bcf046809767572638bdcdc5 lib/core/settings.py
193193
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
194194
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
195195
d35650179816193164a5f177102f18379dfbe6bb6d40fbb67b78d907b41c8038 lib/core/target.py
@@ -634,7 +634,7 @@ ef70b88cc969a3e259868f163ad822832f846196e3f7d7eccb84958c80b7f696 thirdparty/odi
634634
c51c91f703d3d4b3696c923cb5fec213e05e75d9215393befac7f2fa6a3904df thirdparty/six/__init__.py
635635
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 thirdparty/socks/__init__.py
636636
7027e214e014eb78b7adcc1ceda5aca713a79fc4f6a0c52c9da5b3e707e6ffe9 thirdparty/socks/LICENSE
637-
57dba7460c09b7922df68b981e824135f1a6306180ba4c107b626e3232513eff thirdparty/socks/socks.py
637+
56ae8fb03a5cf34cc5babb59f8c2c3bb20388a04f94491f6847989428ce49b82 thirdparty/socks/socks.py
638638
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 thirdparty/termcolor/__init__.py
639639
b14474d467c70f5fe6cb8ed624f79d881c04fe6aeb7d406455da624fe8b3c0df thirdparty/termcolor/termcolor.py
640640
4db695470f664b0d7cd5e6b9f3c94c8d811c4c550f37f17ed7bdab61bc3bdefc thirdparty/wininetpton/__init__.py

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from thirdparty import six
2020

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

thirdparty/socks/socks.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

33
"""SocksiPy - Python SOCKS module.
4-
Version 1.00
4+
Version 1.01
55
66
Copyright 2006 Dan-Haim. All rights reserved.
77
@@ -44,6 +44,7 @@
4444
4545
"""
4646

47+
import functools
4748
import socket
4849
import struct
4950

@@ -107,8 +108,29 @@ def wrapmodule(module):
107108
This will only work on modules that import socket directly into the namespace;
108109
most of the Python Standard Library falls into this category.
109110
"""
110-
if _defaultproxy != None:
111-
module.socket.socket = socksocket
111+
if _defaultproxy is not None:
112+
_orig_socket_ctor = _orgsocket
113+
114+
@functools.wraps(_orig_socket_ctor)
115+
def guarded_socket(*args, **kwargs):
116+
# socket.socket([family[, type[, proto]]])
117+
family = args[0] if len(args) > 0 else kwargs.get("family", socket.AF_INET)
118+
stype = args[1] if len(args) > 1 else kwargs.get("type", socket.SOCK_STREAM)
119+
120+
# Normalize socket type by stripping flags (Py3.3+ may OR these in)
121+
flags = 0
122+
flags |= getattr(socket, "SOCK_CLOEXEC", 0)
123+
flags |= getattr(socket, "SOCK_NONBLOCK", 0)
124+
base_type = stype & ~flags
125+
126+
if family in (socket.AF_INET, getattr(socket, "AF_INET6", socket.AF_INET)) and base_type == socket.SOCK_STREAM:
127+
return socksocket(*args, **kwargs)
128+
129+
# Fallback: don't proxy AF_UNIX / raw / etc.
130+
return _orig_socket_ctor(*args, **kwargs)
131+
132+
module.socket.socket = guarded_socket
133+
112134
if _defaultproxy[0] == PROXY_TYPE_SOCKS4:
113135
# Note: unable to prevent DNS leakage in SOCKS4 (Reference: https://security.stackexchange.com/a/171280)
114136
pass

0 commit comments

Comments
 (0)