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

Skip to content

Commit 98d27ef

Browse files
committed
Bug fix (missing permissions when creating dump directory)
1 parent 16e803c commit 98d27ef

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

lib/core/target.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,16 @@ def _createDumpDir():
462462
conf.dumpPath = paths.SQLMAP_DUMP_PATH % conf.hostname
463463

464464
if not os.path.isdir(conf.dumpPath):
465-
os.makedirs(conf.dumpPath, 0755)
465+
try:
466+
os.makedirs(conf.dumpPath, 0755)
467+
except OSError, ex:
468+
tempDir = tempfile.mkdtemp(prefix="sqlmapdump")
469+
warnMsg = "unable to create dump directory "
470+
warnMsg += "'%s' (%s). " % (conf.dumpPath, ex)
471+
warnMsg += "Using temporary directory '%s' instead" % tempDir
472+
logger.warn(warnMsg)
473+
474+
conf.dumpPath = tempDir
466475

467476
def _configureDumper():
468477
if hasattr(conf, 'xmlFile') and conf.xmlFile:
@@ -484,7 +493,7 @@ def _createTargetDirs():
484493
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
485494
warnMsg = "unable to create default root output directory "
486495
warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, ex)
487-
warnMsg += "using temporary directory '%s' instead" % tempDir
496+
warnMsg += "Using temporary directory '%s' instead" % tempDir
488497
logger.warn(warnMsg)
489498

490499
paths.SQLMAP_OUTPUT_PATH = tempDir
@@ -498,7 +507,7 @@ def _createTargetDirs():
498507
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
499508
warnMsg = "unable to create output directory "
500509
warnMsg += "'%s' (%s). " % (conf.outputPath, ex)
501-
warnMsg += "using temporary directory '%s' instead" % tempDir
510+
warnMsg += "Using temporary directory '%s' instead" % tempDir
502511
logger.warn(warnMsg)
503512

504513
conf.outputPath = tempDir

0 commit comments

Comments
 (0)