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

Skip to content

Commit f9a9ede

Browse files
committed
Patch for an Issue #1106
1 parent 06ff8b3 commit f9a9ede

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/core/option.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ def _createTemporaryDirectory():
14451445

14461446
if not os.path.isdir(tempfile.gettempdir()):
14471447
os.makedirs(tempfile.gettempdir())
1448-
tempfile.tempdir = tempfile.mkdtemp(prefix="sqlmap", suffix=str(os.getpid()))
1448+
kb.tempDir = tempfile.tempdir = tempfile.mkdtemp(prefix="sqlmap", suffix=str(os.getpid()))
14491449
if not os.path.isdir(tempfile.tempdir):
14501450
os.makedirs(tempfile.tempdir)
14511451

@@ -1772,6 +1772,7 @@ def _setKnowledgeBaseAttributes(flushAll=True):
17721772
kb.storeHashesChoice = None
17731773
kb.suppressResumeInfo = False
17741774
kb.technique = None
1775+
kb.tempDir = None
17751776
kb.testMode = False
17761777
kb.testQueryCount = 0
17771778
kb.testType = None

sqlmap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def main():
153153
if conf.get("showTime"):
154154
dataToStdout("\n[*] shutting down at %s\n\n" % time.strftime("%X"), forceOutput=True)
155155

156-
shutil.rmtree(tempfile.tempdir, ignore_errors=True)
156+
if kb.get("tempDir"):
157+
shutil.rmtree(kb.tempDir, ignore_errors=True)
157158

158159
kb.threadContinue = False
159160
kb.threadException = True

0 commit comments

Comments
 (0)