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

Skip to content

Commit af7c8cf

Browse files
committed
Bug fix (previously removing temporary directory even if it is needed afterwards)
1 parent 26d4dec commit af7c8cf

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.revision import getRevisionNumber
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.0.5.125"
22+
VERSION = "1.0.5.126"
2323
REVISION = getRevisionNumber()
2424
STABLE = VERSION.count('.') <= 2
2525
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")

sqlmap.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import bdb
1515
import distutils
16+
import glob
1617
import inspect
1718
import logging
1819
import os
@@ -45,6 +46,7 @@
4546
from lib.core.data import kb
4647
from lib.core.data import paths
4748
from lib.core.common import unhandledExceptionMessage
49+
from lib.core.common import MKSTEMP_PREFIX
4850
from lib.core.exception import SqlmapBaseException
4951
from lib.core.exception import SqlmapShellQuitException
5052
from lib.core.exception import SqlmapSilentQuitException
@@ -254,7 +256,11 @@ def main():
254256
dataToStdout("\n[*] shutting down at %s\n\n" % time.strftime("%X"), forceOutput=True)
255257

256258
if kb.get("tempDir"):
257-
shutil.rmtree(kb.tempDir, ignore_errors=True)
259+
for prefix in (MKSTEMP_PREFIX.IPC, MKSTEMP_PREFIX.TESTING, MKSTEMP_PREFIX.COOKIE_JAR, MKSTEMP_PREFIX.BIG_ARRAY):
260+
for filepath in glob.glob(os.path.join(kb.tempDir, "%s*" % prefix)):
261+
os.remove(filepath)
262+
if not glob.glob(os.path.join(kb.tempDir, '*')):
263+
shutil.rmtree(kb.tempDir, ignore_errors=True)
258264

259265
if conf.get("hashDB"):
260266
try:

0 commit comments

Comments
 (0)