Bug fix (missing permissions when creating dump directory)

This commit is contained in:
Miroslav Stampar 2013-10-11 21:16:48 +02:00
parent 16e803c3ca
commit 98d27ef200

View File

@ -462,7 +462,16 @@ def _createDumpDir():
conf.dumpPath = paths.SQLMAP_DUMP_PATH % conf.hostname conf.dumpPath = paths.SQLMAP_DUMP_PATH % conf.hostname
if not os.path.isdir(conf.dumpPath): if not os.path.isdir(conf.dumpPath):
try:
os.makedirs(conf.dumpPath, 0755) os.makedirs(conf.dumpPath, 0755)
except OSError, ex:
tempDir = tempfile.mkdtemp(prefix="sqlmapdump")
warnMsg = "unable to create dump directory "
warnMsg += "'%s' (%s). " % (conf.dumpPath, ex)
warnMsg += "Using temporary directory '%s' instead" % tempDir
logger.warn(warnMsg)
conf.dumpPath = tempDir
def _configureDumper(): def _configureDumper():
if hasattr(conf, 'xmlFile') and conf.xmlFile: if hasattr(conf, 'xmlFile') and conf.xmlFile:
@ -484,7 +493,7 @@ def _createTargetDirs():
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput") tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
warnMsg = "unable to create default root output directory " warnMsg = "unable to create default root output directory "
warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, ex) warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, ex)
warnMsg += "using temporary directory '%s' instead" % tempDir warnMsg += "Using temporary directory '%s' instead" % tempDir
logger.warn(warnMsg) logger.warn(warnMsg)
paths.SQLMAP_OUTPUT_PATH = tempDir paths.SQLMAP_OUTPUT_PATH = tempDir
@ -498,7 +507,7 @@ def _createTargetDirs():
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput") tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
warnMsg = "unable to create output directory " warnMsg = "unable to create output directory "
warnMsg += "'%s' (%s). " % (conf.outputPath, ex) warnMsg += "'%s' (%s). " % (conf.outputPath, ex)
warnMsg += "using temporary directory '%s' instead" % tempDir warnMsg += "Using temporary directory '%s' instead" % tempDir
logger.warn(warnMsg) logger.warn(warnMsg)
conf.outputPath = tempDir conf.outputPath = tempDir