Always save injections

This commit is contained in:
bkbilly 2023-07-25 13:30:12 +03:00
parent 6152c08cc9
commit 1da1e604bd
2 changed files with 11 additions and 12 deletions

View File

@ -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 "

View File

@ -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))