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

Skip to content

Commit 9c917ec

Browse files
committed
Patch for #3638
1 parent b1efef4 commit 9c917ec

6 files changed

Lines changed: 13 additions & 29 deletions

File tree

lib/core/dump.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -430,15 +430,7 @@ def dbTableValues(self, tableValues):
430430
try:
431431
os.makedirs(dumpDbPath)
432432
except Exception as ex:
433-
try:
434-
tempDir = tempfile.mkdtemp(prefix="sqlmapdb")
435-
except IOError as _:
436-
errMsg = "unable to write to the temporary directory ('%s'). " % _
437-
errMsg += "Please make sure that your disk is not full and "
438-
errMsg += "that you have sufficient write permissions to "
439-
errMsg += "create temporary files and/or directories"
440-
raise SqlmapSystemException(errMsg)
441-
433+
tempDir = tempfile.mkdtemp(prefix="sqlmapdb")
442434
warnMsg = "unable to create dump directory "
443435
warnMsg += "'%s' (%s). " % (dumpDbPath, getSafeExString(ex))
444436
warnMsg += "Using temporary directory '%s' instead" % tempDir

lib/core/option.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,15 +1499,7 @@ def _createHomeDirectories():
14991499
warnMsg = "using '%s' as the %s directory" % (directory, context)
15001500
logger.warn(warnMsg)
15011501
except (OSError, IOError) as ex:
1502-
try:
1503-
tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context)
1504-
except Exception as _:
1505-
errMsg = "unable to write to the temporary directory ('%s'). " % _
1506-
errMsg += "Please make sure that your disk is not full and "
1507-
errMsg += "that you have sufficient write permissions to "
1508-
errMsg += "create temporary files and/or directories"
1509-
raise SqlmapSystemException(errMsg)
1510-
1502+
tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context)
15111503
warnMsg = "unable to %s %s directory " % ("create" if not os.path.isdir(directory) else "write to the", context)
15121504
warnMsg += "'%s' (%s). " % (directory, getUnicode(ex))
15131505
warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir)

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty import six
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.5.63"
21+
VERSION = "1.3.5.64"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/core/target.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -638,15 +638,7 @@ def _createTargetDirs():
638638
if not os.path.isdir(conf.outputPath):
639639
os.makedirs(conf.outputPath)
640640
except (OSError, IOError, TypeError) as ex:
641-
try:
642-
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
643-
except Exception as _:
644-
errMsg = "unable to write to the temporary directory ('%s'). " % _
645-
errMsg += "Please make sure that your disk is not full and "
646-
errMsg += "that you have sufficient write permissions to "
647-
errMsg += "create temporary files and/or directories"
648-
raise SqlmapSystemException(errMsg)
649-
641+
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
650642
warnMsg = "unable to create output directory "
651643
warnMsg += "'%s' (%s). " % (conf.outputPath, getUnicode(ex))
652644
warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir)

lib/utils/versioncheck.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
See the file 'LICENSE' for copying permission
66
"""
77

8-
import os
98
import sys
109
import time
1110

sqlmap.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import re
2828
import shutil
2929
import sys
30+
import tempfile
3031
import threading
3132
import time
3233
import traceback
@@ -284,6 +285,14 @@ def main():
284285
logger.critical(errMsg)
285286
raise SystemExit
286287

288+
elif any(_ in excMsg for _ in ("tempfile.mkdtemp", "tempfile.mkstemp")):
289+
errMsg = "unable to write to the temporary directory '%s'. " % tempfile.gettempdir()
290+
errMsg += "Please make sure that your disk is not full and "
291+
errMsg += "that you have sufficient write permissions to "
292+
errMsg += "create temporary files and/or directories"
293+
logger.critical(errMsg)
294+
raise SystemExit
295+
287296
elif all(_ in excMsg for _ in ("twophase", "sqlalchemy")):
288297
errMsg = "please update the 'sqlalchemy' package (>= 1.1.11) "
289298
errMsg += "(Reference: https://qiita.com/tkprof/items/7d7b2d00df9c5f16fffe)"

0 commit comments

Comments
 (0)