diff --git a/lib/core/dump.py b/lib/core/dump.py index 333b09b0b..e2d90b304 100644 --- a/lib/core/dump.py +++ b/lib/core/dump.py @@ -430,15 +430,7 @@ class Dump(object): try: os.makedirs(dumpDbPath) except Exception as ex: - try: - tempDir = tempfile.mkdtemp(prefix="sqlmapdb") - except IOError as _: - errMsg = "unable to write to the temporary directory ('%s'). " % _ - errMsg += "Please make sure that your disk is not full and " - errMsg += "that you have sufficient write permissions to " - errMsg += "create temporary files and/or directories" - raise SqlmapSystemException(errMsg) - + tempDir = tempfile.mkdtemp(prefix="sqlmapdb") warnMsg = "unable to create dump directory " warnMsg += "'%s' (%s). " % (dumpDbPath, getSafeExString(ex)) warnMsg += "Using temporary directory '%s' instead" % tempDir diff --git a/lib/core/option.py b/lib/core/option.py index 2ed1b9677..8a376bf59 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -1499,15 +1499,7 @@ def _createHomeDirectories(): warnMsg = "using '%s' as the %s directory" % (directory, context) logger.warn(warnMsg) except (OSError, IOError) as ex: - try: - tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context) - except Exception as _: - errMsg = "unable to write to the temporary directory ('%s'). " % _ - errMsg += "Please make sure that your disk is not full and " - errMsg += "that you have sufficient write permissions to " - errMsg += "create temporary files and/or directories" - raise SqlmapSystemException(errMsg) - + tempDir = tempfile.mkdtemp(prefix="sqlmap%s" % context) warnMsg = "unable to %s %s directory " % ("create" if not os.path.isdir(directory) else "write to the", context) warnMsg += "'%s' (%s). " % (directory, getUnicode(ex)) warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir) diff --git a/lib/core/settings.py b/lib/core/settings.py index 742ac34a3..085e2afc2 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty import six # sqlmap version (...) -VERSION = "1.3.5.63" +VERSION = "1.3.5.64" 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) diff --git a/lib/core/target.py b/lib/core/target.py index 9d4d9f28b..c5dc262ac 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -638,15 +638,7 @@ def _createTargetDirs(): if not os.path.isdir(conf.outputPath): os.makedirs(conf.outputPath) except (OSError, IOError, TypeError) as ex: - try: - tempDir = tempfile.mkdtemp(prefix="sqlmapoutput") - except Exception as _: - errMsg = "unable to write to the temporary directory ('%s'). " % _ - errMsg += "Please make sure that your disk is not full and " - errMsg += "that you have sufficient write permissions to " - errMsg += "create temporary files and/or directories" - raise SqlmapSystemException(errMsg) - + tempDir = tempfile.mkdtemp(prefix="sqlmapoutput") warnMsg = "unable to create output directory " warnMsg += "'%s' (%s). " % (conf.outputPath, getUnicode(ex)) warnMsg += "Using temporary directory '%s' instead" % getUnicode(tempDir) diff --git a/lib/utils/versioncheck.py b/lib/utils/versioncheck.py index 253d0e19b..55fef3595 100644 --- a/lib/utils/versioncheck.py +++ b/lib/utils/versioncheck.py @@ -5,7 +5,6 @@ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/) See the file 'LICENSE' for copying permission """ -import os import sys import time diff --git a/sqlmap.py b/sqlmap.py index 3a60cd25c..c186c48f4 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -27,6 +27,7 @@ try: import re import shutil import sys + import tempfile import threading import time import traceback @@ -284,6 +285,14 @@ def main(): logger.critical(errMsg) raise SystemExit + elif any(_ in excMsg for _ in ("tempfile.mkdtemp", "tempfile.mkstemp")): + errMsg = "unable to write to the temporary directory '%s'. " % tempfile.gettempdir() + errMsg += "Please make sure that your disk is not full and " + errMsg += "that you have sufficient write permissions to " + errMsg += "create temporary files and/or directories" + logger.critical(errMsg) + raise SystemExit + elif all(_ in excMsg for _ in ("twophase", "sqlalchemy")): errMsg = "please update the 'sqlalchemy' package (>= 1.1.11) " errMsg += "(Reference: https://qiita.com/tkprof/items/7d7b2d00df9c5f16fffe)"