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

Skip to content

Commit d6255de

Browse files
committed
Fixes #2231
1 parent c293a6a commit d6255de

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lib/core/option.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ def _setSocketPreConnect():
10411041
return
10421042

10431043
def _():
1044-
while kb.threadContinue and not conf.disablePrecon:
1044+
while kb.get("threadContinue") and not conf.get("disablePrecon"):
10451045
try:
10461046
for key in socket._ready:
10471047
if len(socket._ready[key]) < SOCKET_PRE_CONNECT_QUEUE_SIZE:
@@ -1776,6 +1776,17 @@ def _cleanupOptions():
17761776
threadData = getCurrentThreadData()
17771777
threadData.reset()
17781778

1779+
def _cleanupEnvironment():
1780+
"""
1781+
Cleanup environment (e.g. from leftovers after --sqlmap-shell).
1782+
"""
1783+
1784+
if issubclass(urllib2.socket.socket, socks.socksocket):
1785+
socks.unwrapmodule(urllib2)
1786+
1787+
if hasattr(socket, "_ready"):
1788+
socket._ready.clear()
1789+
17791790
def _dirtyPatches():
17801791
"""
17811792
Place for "dirty" Python related patches
@@ -2620,6 +2631,7 @@ def init():
26202631
_saveConfig()
26212632
_setRequestFromFile()
26222633
_cleanupOptions()
2634+
_cleanupEnvironment()
26232635
_dirtyPatches()
26242636
_purgeOutput()
26252637
_checkDependencies()

0 commit comments

Comments
 (0)