Patch for an Issue #746

This commit is contained in:
Miroslav Stampar 2014-07-02 10:09:19 +02:00
parent 4e909a2a05
commit 1eecabaea8
2 changed files with 12 additions and 16 deletions

View File

@ -1043,7 +1043,7 @@ def setPaths():
paths.SQLMAP_UDF_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "udf") paths.SQLMAP_UDF_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "udf")
paths.SQLMAP_XML_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "xml") paths.SQLMAP_XML_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "xml")
paths.SQLMAP_XML_BANNER_PATH = os.path.join(paths.SQLMAP_XML_PATH, "banner") paths.SQLMAP_XML_BANNER_PATH = os.path.join(paths.SQLMAP_XML_PATH, "banner")
paths.SQLMAP_OUTPUT_PATH = paths.get("SQLMAP_OUTPUT_PATH", os.path.join(paths.SQLMAP_ROOT_PATH, "output")) paths.SQLMAP_OUTPUT_PATH = paths.get("SQLMAP_OUTPUT_PATH", os.path.join(os.path.expanduser("~"), ".sqlmap", "output"))
paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump") paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump")
paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files") paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files")

View File

@ -512,22 +512,18 @@ def _createTargetDirs():
if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH): if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH):
try: try:
os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0755) if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH):
except OSError, ex: os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0755)
paths.SQLMAP_OUTPUT_PATH = os.path.join(os.path.expanduser("~"), ".sqlmap", "output") warnMsg = "using '%s' as the output directory" % paths.SQLMAP_OUTPUT_PATH
try: logger.warn(warnMsg)
if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH): except OSError, ex:
os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0755) tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
warnMsg = "using '%s' as the output directory" % paths.SQLMAP_OUTPUT_PATH warnMsg = "unable to create regular output directory "
logger.warn(warnMsg) warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, ex)
except OSError, ex: warnMsg += "Using temporary directory '%s' instead" % tempDir
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput") logger.warn(warnMsg)
warnMsg = "unable to create regular output directory "
warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, ex)
warnMsg += "Using temporary directory '%s' instead" % tempDir
logger.warn(warnMsg)
paths.SQLMAP_OUTPUT_PATH = tempDir paths.SQLMAP_OUTPUT_PATH = tempDir
conf.outputPath = os.path.join(paths.SQLMAP_OUTPUT_PATH, getUnicode(conf.hostname)) conf.outputPath = os.path.join(paths.SQLMAP_OUTPUT_PATH, getUnicode(conf.hostname))