Added --crawl-file option

Added --crawl-file option to specify the output file for crawler
results.
This commit is contained in:
ctshanghai 2015-08-03 21:10:44 +08:00
parent e623ee66ad
commit dc3df1b832
2 changed files with 11 additions and 6 deletions

View File

@ -610,6 +610,9 @@ def cmdLineParser():
help="Log all HTTP traffic into a " help="Log all HTTP traffic into a "
"textual file") "textual file")
general.add_option("--crawl-file", dest="batchCrawlFile", action="store",
help="Destination file for crawled links")
general.add_option("--batch", dest="batch", general.add_option("--batch", dest="batch",
action="store_true", action="store_true",
help="Never ask for user input, use the default behaviour") help="Never ask for user input, use the default behaviour")

View File

@ -186,12 +186,14 @@ def storeResultsToFile(results):
test = readInput(message, default="N") test = readInput(message, default="N")
kb.storeCrawlingChoice = test[0] in ("y", "Y") kb.storeCrawlingChoice = test[0] in ("y", "Y")
if kb.storeCrawlingChoice: if kb.storeCrawlingChoice or conf.batchCrawlFile:
handle, filename = tempfile.mkstemp(prefix="sqlmapcrawling-", suffix=".csv" if conf.forms else ".txt") if conf.batchCrawlFile:
os.close(handle) filename = conf.batchCrawlFile
else:
infoMsg = "writing crawling results to a temporary file '%s' " % filename handle, filename = tempfile.mkstemp(prefix="sqlmapcrawling-", suffix=".csv" if conf.forms else ".txt")
logger.info(infoMsg) os.close(handle)
infoMsg = "writing crawling results to a temporary file '%s' " % filename
logger.info(infoMsg)
with openFile(filename, "w+b") as f: with openFile(filename, "w+b") as f:
if conf.forms: if conf.forms: