This commit is contained in:
Miroslav Stampar 2016-10-17 12:33:07 +02:00
parent c293a6a25a
commit d6255de205

View File

@ -1041,7 +1041,7 @@ def _setSocketPreConnect():
return return
def _(): def _():
while kb.threadContinue and not conf.disablePrecon: while kb.get("threadContinue") and not conf.get("disablePrecon"):
try: try:
for key in socket._ready: for key in socket._ready:
if len(socket._ready[key]) < SOCKET_PRE_CONNECT_QUEUE_SIZE: if len(socket._ready[key]) < SOCKET_PRE_CONNECT_QUEUE_SIZE:
@ -1776,6 +1776,17 @@ def _cleanupOptions():
threadData = getCurrentThreadData() threadData = getCurrentThreadData()
threadData.reset() threadData.reset()
def _cleanupEnvironment():
"""
Cleanup environment (e.g. from leftovers after --sqlmap-shell).
"""
if issubclass(urllib2.socket.socket, socks.socksocket):
socks.unwrapmodule(urllib2)
if hasattr(socket, "_ready"):
socket._ready.clear()
def _dirtyPatches(): def _dirtyPatches():
""" """
Place for "dirty" Python related patches Place for "dirty" Python related patches
@ -2620,6 +2631,7 @@ def init():
_saveConfig() _saveConfig()
_setRequestFromFile() _setRequestFromFile()
_cleanupOptions() _cleanupOptions()
_cleanupEnvironment()
_dirtyPatches() _dirtyPatches()
_purgeOutput() _purgeOutput()
_checkDependencies() _checkDependencies()