diff --git a/lib/core/target.py b/lib/core/target.py index c1bf921bd..c33c99d65 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -508,7 +508,9 @@ def _setResultsFile(): return if not conf.resultsFP: - conf.resultsFilename = os.path.join(paths.SQLMAP_OUTPUT_PATH, time.strftime(RESULTS_FILE_FORMAT).lower()) + if not len(conf.resultsFilename): + conf.resultsFilename = os.path.join(paths.SQLMAP_OUTPUT_PATH, time.strftime(RESULTS_FILE_FORMAT).lower()) + try: conf.resultsFP = openFile(conf.resultsFilename, "w+", UNICODE_ENCODING, buffering=0) except (OSError, IOError), ex: diff --git a/lib/parse/cmdline.py b/lib/parse/cmdline.py index 154c5d7e3..28040e785 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -610,6 +610,12 @@ def cmdLineParser(): help="Log all HTTP traffic into a " "textual file") + general.add_option("--crawl-file", dest="crawlFile", action="store", + help="Destination file for crawled links") + + general.add_option("--results-file", dest="resultsFilename", action="store", + help="Destination file for results in multi-target mode") + general.add_option("--batch", dest="batch", action="store_true", help="Never ask for user input, use the default behaviour") diff --git a/lib/utils/crawler.py b/lib/utils/crawler.py index be47608e1..c42d25319 100644 --- a/lib/utils/crawler.py +++ b/lib/utils/crawler.py @@ -186,12 +186,14 @@ def storeResultsToFile(results): test = readInput(message, default="N") kb.storeCrawlingChoice = test[0] in ("y", "Y") - if kb.storeCrawlingChoice: - handle, filename = tempfile.mkstemp(prefix="sqlmapcrawling-", suffix=".csv" if conf.forms else ".txt") - os.close(handle) - - infoMsg = "writing crawling results to a temporary file '%s' " % filename - logger.info(infoMsg) + if kb.storeCrawlingChoice or conf.crawlFile: + if conf.crawlFile: + filename = conf.crawlFile + else: + handle, filename = tempfile.mkstemp(prefix="sqlmapcrawling-", suffix=".csv" if conf.forms else ".txt") + os.close(handle) + infoMsg = "writing crawling results to a temporary file '%s' " % filename + logger.info(infoMsg) with openFile(filename, "w+b") as f: if conf.forms: