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

Function storeResultsToFile

lib/utils/crawler.py:240–265  ·  view source on GitHub ↗
(results)

Source from the content-addressed store, hash-verified

238 storeResultsToFile(kb.targets)
239
240def storeResultsToFile(results):
241 if not results:
242 return
243
244 if kb.storeCrawlingChoice is None:
245 message = "do you want to store crawling results to a temporary file "
246 message += "for eventual further processing with other tools [y/N] "
247
248 kb.storeCrawlingChoice = readInput(message, default='N', boolean=True)
249
250 if kb.storeCrawlingChoice:
251 handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.CRAWLER, suffix=".csv" if conf.forms else ".txt")
252 os.close(handle)
253
254 infoMsg = "writing crawling results to a temporary file '%s' " % filename
255 logger.info(infoMsg)
256
257 with openFile(filename, "w+b") as f:
258 if conf.forms:
259 f.write("URL,POST\n")
260
261 for url, _, data, _, _ in results:
262 if conf.forms:
263 f.write("%s,%s\n" % (safeCSValue(url), safeCSValue(data or "")))
264 else:
265 f.write("%s\n" % url)

Callers 1

crawlFunction · 0.85

Calls 6

readInputFunction · 0.90
openFileFunction · 0.90
safeCSValueFunction · 0.90
infoMethod · 0.80
closeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…