mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-06-20 14:40:36 +00:00
Adding --report-json option
This commit is contained in:
parent
948d01d57a
commit
17e94c3409
13 changed files with 581 additions and 69 deletions
19
sqlmap.py
19
sqlmap.py
|
|
@ -176,6 +176,10 @@ def main():
|
|||
|
||||
init()
|
||||
|
||||
if conf.get("reportJson"):
|
||||
from lib.utils.api import setupReportCollector
|
||||
conf.reportCollector = setupReportCollector()
|
||||
|
||||
if not conf.updateAll:
|
||||
# Postponed imports (faster start)
|
||||
if conf.smokeTest:
|
||||
|
|
@ -568,6 +572,21 @@ def main():
|
|||
warnMsg = "your sqlmap version is outdated"
|
||||
logger.warning(warnMsg)
|
||||
|
||||
# emit the JSON report BEFORE the closing banner, so it does not appear awkwardly after
|
||||
# "[*] ending @ ..."
|
||||
if conf.get("reportCollector") is not None:
|
||||
try:
|
||||
from lib.utils.api import writeReportJson
|
||||
writeReportJson(conf.reportCollector, conf.reportJson)
|
||||
logger.info("JSON report written to '%s'" % conf.reportJson)
|
||||
except Exception as ex:
|
||||
logger.error("unable to write JSON report to '%s' ('%s')" % (conf.reportJson, getSafeExString(ex)))
|
||||
finally:
|
||||
try:
|
||||
conf.reportCollector.disconnect()
|
||||
except Exception as ex:
|
||||
logger.debug("problem occurred while closing the report collector ('%s')" % getSafeExString(ex))
|
||||
|
||||
if conf.get("showTime"):
|
||||
dataToStdout("\n[*] ending @ %s\n\n" % time.strftime("%X /%Y-%m-%d/"), forceOutput=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue