Skip to content

Commit

Permalink
Patch for sqlmapproject#3638
Browse files Browse the repository at this point in the history
  • Loading branch information
stamparm committed May 9, 2019
1 parent b1efef4 commit 9c917ec
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 29 deletions.
10 changes: 1 addition & 9 deletions lib/core/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,15 +430,7 @@ def dbTableValues(self, tableValues):
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
Expand Down
10 changes: 1 addition & 9 deletions lib/core/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from thirdparty import six

# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
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)
Expand Down
10 changes: 1 addition & 9 deletions lib/core/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion lib/utils/versioncheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
See the file 'LICENSE' for copying permission
"""

import os
import sys
import time

Expand Down
9 changes: 9 additions & 0 deletions sqlmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import re
import shutil
import sys
import tempfile
import threading
import time
import traceback
Expand Down Expand Up @@ -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)"
Expand Down

0 comments on commit 9c917ec

Please sign in to comment.