mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-05-13 17:06:53 +00:00
Fixes leakage of sqlmap temporary directories
This commit is contained in:
parent
da65936a3c
commit
de10cff3e0
4 changed files with 13 additions and 10 deletions
|
|
@ -567,17 +567,17 @@ def main():
|
|||
|
||||
kb.threadException = True
|
||||
|
||||
if kb.get("tempDir"):
|
||||
for tempDir in conf.get("tempDirs", []):
|
||||
for prefix in (MKSTEMP_PREFIX.IPC, MKSTEMP_PREFIX.TESTING, MKSTEMP_PREFIX.COOKIE_JAR, MKSTEMP_PREFIX.BIG_ARRAY):
|
||||
for filepath in glob.glob(os.path.join(kb.tempDir, "%s*" % prefix)):
|
||||
for filepath in glob.glob(os.path.join(tempDir, "%s*" % prefix)):
|
||||
try:
|
||||
os.remove(filepath)
|
||||
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", ".so", '_'))): # ignore junk files
|
||||
if any((conf.vulnTest, conf.smokeTest)) or not filterNone(filepath for filepath in glob.glob(os.path.join(tempDir, '*')) if not any(filepath.endswith(_) for _ in (".lock", ".exe", ".so", '_'))): # ignore junk files
|
||||
try:
|
||||
shutil.rmtree(kb.tempDir, ignore_errors=True)
|
||||
shutil.rmtree(tempDir, ignore_errors=True)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue