Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Always save injections
  • Loading branch information
bkbilly committed Nov 16, 2023
commit 1da1e604bda6830f152c3b090c5fa01820e8ec57
20 changes: 11 additions & 9 deletions lib/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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 "
Expand Down
3 changes: 0 additions & 3 deletions lib/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down