MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / wrapmodule

Function wrapmodule

thirdparty/socks/socks.py:103–118  ·  view source on GitHub ↗

wrapmodule(module) Attempts to replace a module's socket library with a SOCKS socket. Must set a default proxy using setdefaultproxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls into this category

(module)

Source from the content-addressed store, hash-verified

101 _defaultproxy = (proxytype, addr, port, rdns, username, password)
102
103def wrapmodule(module):
104 """wrapmodule(module)
105 Attempts to replace a module's socket library with a SOCKS socket. Must set
106 a default proxy using setdefaultproxy(...) first.
107 This will only work on modules that import socket directly into the namespace;
108 most of the Python Standard Library falls into this category.
109 """
110 if _defaultproxy != None:
111 module.socket.socket = socksocket
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
117 else:
118 raise GeneralProxyError((4, "no proxy specified"))
119
120def unwrapmodule(module):
121 module.socket.socket = _orgsocket

Callers

nothing calls this directly

Calls 1

GeneralProxyErrorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…