mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Minor DREI patch (leaky multiprocessing)
This commit is contained in:
parent
f8f57e1030
commit
c5a2567033
|
@ -4650,6 +4650,7 @@ def decloakToTemp(filename):
|
|||
>>> _ = decloakToTemp(os.path.join(paths.SQLMAP_SHELL_PATH, "stagers", "stager.asp_"))
|
||||
>>> openFile(_, "rb", encoding=None).read().startswith(b'<%')
|
||||
True
|
||||
>>> os.remove(_)
|
||||
"""
|
||||
|
||||
content = decloak(filename)
|
||||
|
|
|
@ -1519,6 +1519,9 @@ def _createHomeDirectories():
|
|||
|
||||
paths["SQLMAP_%s_PATH" % context.upper()] = tempDir
|
||||
|
||||
def _pympTempLeakPatch(tempDir): # Cross-referenced function
|
||||
raise NotImplementedError
|
||||
|
||||
def _createTemporaryDirectory():
|
||||
"""
|
||||
Creates temporary directory for this run.
|
||||
|
@ -1570,6 +1573,9 @@ def _createTemporaryDirectory():
|
|||
errMsg += "temporary directory location ('%s')" % getSafeExString(ex)
|
||||
raise SqlmapSystemException(errMsg)
|
||||
|
||||
if six.PY3:
|
||||
_pympTempLeakPatch(kb.tempDir)
|
||||
|
||||
def _cleanupOptions():
|
||||
"""
|
||||
Cleanup configuration attributes.
|
||||
|
|
|
@ -11,6 +11,7 @@ import lib.controller.checks
|
|||
import lib.core.common
|
||||
import lib.core.threads
|
||||
import lib.core.convert
|
||||
import lib.core.option
|
||||
import lib.request.connect
|
||||
import lib.utils.search
|
||||
import thirdparty.ansistrm.ansistrm
|
||||
|
@ -61,8 +62,20 @@ def resolveCrossReferences():
|
|||
lib.core.convert.filterNone = filterNone
|
||||
lib.core.convert.isListLike = isListLike
|
||||
lib.core.convert.singleTimeWarnMessage = singleTimeWarnMessage
|
||||
lib.core.option._pympTempLeakPatch = pympTempLeakPatch
|
||||
lib.request.connect.setHTTPHandlers = _setHTTPHandlers
|
||||
lib.utils.search.setHTTPHandlers = _setHTTPHandlers
|
||||
lib.controller.checks.setVerbosity = setVerbosity
|
||||
lib.controller.checks.setWafFunctions = _setWafFunctions
|
||||
thirdparty.ansistrm.ansistrm.stdoutencode = stdoutencode
|
||||
|
||||
def pympTempLeakPatch(tempDir):
|
||||
"""
|
||||
Patch for "pymp" leaking directories inside Python3
|
||||
"""
|
||||
|
||||
try:
|
||||
import multiprocessing.util
|
||||
multiprocessing.util.get_temp_dir = lambda: tempDir
|
||||
except:
|
||||
pass
|
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.3.5.29"
|
||||
VERSION = "1.3.5.30"
|
||||
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
|
||||
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
|
||||
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
|
||||
|
|
|
@ -378,7 +378,7 @@ def main():
|
|||
except OSError:
|
||||
pass
|
||||
|
||||
if not filterNone(filepath for filepath in glob.glob(os.path.join(kb.tempDir, '*')) if not any(filepath.endswith(_) for _ in ('.lock', '.exe', '_'))):
|
||||
if not filterNone(filepath for filepath in glob.glob(os.path.join(kb.tempDir, '*')) if not any(filepath.endswith(_) for _ in (".lock", ".exe", ".so", '_'))): # ignore junk files
|
||||
try:
|
||||
shutil.rmtree(kb.tempDir, ignore_errors=True)
|
||||
except OSError:
|
||||
|
|
Loading…
Reference in New Issue
Block a user