From c924582df31d529065ee825c96da08c2304af395 Mon Sep 17 00:00:00 2001 From: ctshanghai Date: Mon, 3 Aug 2015 21:55:07 +0800 Subject: [PATCH] Added --results-file to control results ouput file Added the ability to explicitly set the results file output name to ease integration with some external tooling. --- lib/core/target.py | 4 +++- lib/parse/cmdline.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 3a218bc21..28040e785 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -613,6 +613,9 @@ def cmdLineParser(): 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")