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

Skip to content

Commit 1eecaba

Browse files
committed
Patch for an Issue #746
1 parent 4e909a2 commit 1eecaba

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ def setPaths():
10431043
paths.SQLMAP_UDF_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "udf")
10441044
paths.SQLMAP_XML_PATH = os.path.join(paths.SQLMAP_ROOT_PATH, "xml")
10451045
paths.SQLMAP_XML_BANNER_PATH = os.path.join(paths.SQLMAP_XML_PATH, "banner")
1046-
paths.SQLMAP_OUTPUT_PATH = paths.get("SQLMAP_OUTPUT_PATH", os.path.join(paths.SQLMAP_ROOT_PATH, "output"))
1046+
paths.SQLMAP_OUTPUT_PATH = paths.get("SQLMAP_OUTPUT_PATH", os.path.join(os.path.expanduser("~"), ".sqlmap", "output"))
10471047

10481048
paths.SQLMAP_DUMP_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "dump")
10491049
paths.SQLMAP_FILES_PATH = os.path.join(paths.SQLMAP_OUTPUT_PATH, "%s", "files")

lib/core/target.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -512,22 +512,18 @@ def _createTargetDirs():
512512

513513
if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH):
514514
try:
515-
os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0755)
516-
except OSError, ex:
517-
paths.SQLMAP_OUTPUT_PATH = os.path.join(os.path.expanduser("~"), ".sqlmap", "output")
518-
try:
519-
if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH):
520-
os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0755)
521-
warnMsg = "using '%s' as the output directory" % paths.SQLMAP_OUTPUT_PATH
522-
logger.warn(warnMsg)
523-
except OSError, ex:
524-
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
525-
warnMsg = "unable to create regular output directory "
526-
warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, ex)
527-
warnMsg += "Using temporary directory '%s' instead" % tempDir
528-
logger.warn(warnMsg)
529-
530-
paths.SQLMAP_OUTPUT_PATH = tempDir
515+
if not os.path.isdir(paths.SQLMAP_OUTPUT_PATH):
516+
os.makedirs(paths.SQLMAP_OUTPUT_PATH, 0755)
517+
warnMsg = "using '%s' as the output directory" % paths.SQLMAP_OUTPUT_PATH
518+
logger.warn(warnMsg)
519+
except OSError, ex:
520+
tempDir = tempfile.mkdtemp(prefix="sqlmapoutput")
521+
warnMsg = "unable to create regular output directory "
522+
warnMsg += "'%s' (%s). " % (paths.SQLMAP_OUTPUT_PATH, ex)
523+
warnMsg += "Using temporary directory '%s' instead" % tempDir
524+
logger.warn(warnMsg)
525+
526+
paths.SQLMAP_OUTPUT_PATH = tempDir
531527

532528
conf.outputPath = os.path.join(paths.SQLMAP_OUTPUT_PATH, getUnicode(conf.hostname))
533529

0 commit comments

Comments
 (0)