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

Skip to content

Commit 557da5d

Browse files
committed
Bug fix (SOCKS4 patch)
1 parent 2f53014 commit 557da5d

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

lib/core/option.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,10 @@ def _setHTTPHandlers():
10891089
if scheme in (PROXY_TYPE.SOCKS4, PROXY_TYPE.SOCKS5):
10901090
proxyHandler.proxies = {}
10911091

1092+
if scheme == PROXY_TYPE.SOCKS4:
1093+
warnMsg = "SOCKS4 does not support resolving (DNS) names (i.e. causing DNS leakage)"
1094+
singleTimeWarnMessage(warnMsg)
1095+
10921096
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 if scheme == PROXY_TYPE.SOCKS5 else socks.PROXY_TYPE_SOCKS4, hostname, port, username=username, password=password)
10931097
socks.wrapmodule(_http_client)
10941098
else:

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from lib.core.enums import OS
1818

1919
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
20-
VERSION = "1.3.3.57"
20+
VERSION = "1.3.3.58"
2121
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2222
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2323
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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ def wrapmodule(module):
109109
"""
110110
if _defaultproxy != None:
111111
module.socket.socket = socksocket
112-
module.socket.create_connection = create_connection
112+
if _defaultproxy[0] == PROXY_TYPE_SOCKS4:
113+
# Note: unable to prevent DNS leakage in SOCKS4 (Reference: https://security.stackexchange.com/a/171280)
114+
pass
115+
else:
116+
module.socket.create_connection = create_connection
113117
else:
114118
raise GeneralProxyError((4, "no proxy specified"))
115119

0 commit comments

Comments
 (0)