From 1da1e604bda6830f152c3b090c5fa01820e8ec57 Mon Sep 17 00:00:00 2001 From: bkbilly Date: Tue, 25 Jul 2023 13:30:12 +0300 Subject: [PATCH] Always save injections --- lib/controller/controller.py | 20 +++++++++++--------- lib/core/common.py | 3 --- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/controller/controller.py b/lib/controller/controller.py index 27398d3b3..7d43290a8 100644 --- a/lib/controller/controller.py +++ b/lib/controller/controller.py @@ -177,15 +177,6 @@ def _showInjections(): else: header = "sqlmap resumed the following injection point(s) from stored session" - if conf.jsonFile: - data = { - "url": conf.url, - "query": conf.parameters.get(PLACE.GET), - "data": conf.parameters.get(PLACE.POST), - "injections": kb.injections, - } - conf.dumper.json(conf.jsonFile, data) - if conf.api: conf.dumper.string("", {"url": conf.url, "query": conf.parameters.get(PLACE.GET), "data": conf.parameters.get(PLACE.POST)}, content_type=CONTENT_TYPE.TARGET) conf.dumper.string("", kb.injections, content_type=CONTENT_TYPE.TECHNIQUES) @@ -203,6 +194,16 @@ def _showInjections(): warnMsg += "included in shown payload content(s)" logger.warning(warnMsg) +def _saveInjections(): + if conf.jsonFile: + data = { + "url": conf.url, + "query": conf.parameters.get(PLACE.GET), + "data": conf.parameters.get(PLACE.POST), + "injections": kb.injections, + } + conf.dumper.json(conf.jsonFile, data) + def _randomFillBlankFields(value): retVal = value @@ -658,6 +659,7 @@ def start(): if place == PLACE.COOKIE: kb.mergeCookies = popValue() + _saveInjections() if len(kb.injections) == 0 or (len(kb.injections) == 1 and kb.injections[0].place is None): if kb.vainRun and not conf.multipleTargets: errMsg = "no parameter(s) found for testing in the provided data " diff --git a/lib/core/common.py b/lib/core/common.py index 75bba1b0b..06fb47438 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -1072,9 +1072,6 @@ def dataToDumpFile(dumpFile, data): logger.error(errMsg) def dataToJsonFile(jsonFile, data): - print("***************") - print(jsonFile, data) - print("***************") with open(jsonFile, 'w') as f: f.write(json.dumps(data))