MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / _setResultsFile

Function _setResultsFile

lib/core/target.py:571–604  ·  view source on GitHub ↗

Create results file for storing results of running in a multiple target mode.

()

Source from the content-addressed store, hash-verified

569 Backend.setOs(conf.os)
570
571def _setResultsFile():
572 """
573 Create results file for storing results of running in a
574 multiple target mode.
575 """
576
577 if not conf.multipleTargets:
578 return
579
580 if not conf.resultsFP:
581 conf.resultsFile = conf.resultsFile or os.path.join(paths.SQLMAP_OUTPUT_PATH, time.strftime(RESULTS_FILE_FORMAT).lower())
582 found = os.path.exists(conf.resultsFile)
583
584 try:
585 conf.resultsFP = openFile(conf.resultsFile, "a", UNICODE_ENCODING, buffering=0)
586 except (OSError, IOError) as ex:
587 try:
588 warnMsg = "unable to create results file '%s' ('%s'). " % (conf.resultsFile, getUnicode(ex))
589 handle, conf.resultsFile = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.RESULTS, suffix=".csv")
590 os.close(handle)
591 conf.resultsFP = openFile(conf.resultsFile, "w+", UNICODE_ENCODING, buffering=0)
592 warnMsg += "Using temporary file '%s' instead" % conf.resultsFile
593 logger.warning(warnMsg)
594 except IOError as _:
595 errMsg = "unable to write to the temporary directory ('%s'). " % _
596 errMsg += "Please make sure that your disk is not full and "
597 errMsg += "that you have sufficient write permissions to "
598 errMsg += "create temporary files and/or directories"
599 raise SqlmapSystemException(errMsg)
600
601 if not found:
602 conf.resultsFP.writelines("Target URL,Place,Parameter,Technique(s),Note(s)%s" % os.linesep)
603
604 logger.info("using '%s' as the CSV results file in multiple targets mode" % conf.resultsFile)
605
606def _createFilesDir():
607 """

Callers 1

setupTargetEnvFunction · 0.85

Calls 6

openFileFunction · 0.90
getUnicodeFunction · 0.90
writelinesMethod · 0.80
infoMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…