@@ -223,6 +223,9 @@ def _autoWafBypass(place, parameter, value):
223223
224224 return retVal
225225
226+ def _targetInfo ():
227+ return {"url" : conf .url , "query" : conf .parameters .get (PLACE .GET ), "data" : conf .parameters .get (PLACE .POST )}
228+
226229def _showInjections ():
227230 if conf .wizard and kb .wizardMode :
228231 kb .wizardMode = False
@@ -234,13 +237,12 @@ def _showInjections():
234237 header = "sqlmap resumed the following injection point(s) from stored session"
235238
236239 if conf .api :
237- conf .dumper .string ("" , { "url" : conf . url , "query" : conf . parameters . get ( PLACE . GET ), "data" : conf . parameters . get ( PLACE . POST )} , content_type = CONTENT_TYPE .TARGET )
240+ conf .dumper .string ("" , _targetInfo () , content_type = CONTENT_TYPE .TARGET )
238241 conf .dumper .string ("" , kb .injections , content_type = CONTENT_TYPE .TECHNIQUES )
239242 else :
240- # --report-json: capture the same TARGET/ TECHNIQUES structures the API emits, without
241- # printing them (the human-readable injection points are rendered just below)
243+ # --report-json: capture the same TECHNIQUES structure the API emits, without printing it (the
244+ # human-readable injection points are rendered just below); TARGET is reported per target in start( )
242245 if conf .reportJson :
243- conf .dumper ._reportData ({"url" : conf .url , "query" : conf .parameters .get (PLACE .GET ), "data" : conf .parameters .get (PLACE .POST )}, CONTENT_TYPE .TARGET )
244246 conf .dumper ._reportData (kb .injections , CONTENT_TYPE .TECHNIQUES )
245247
246248 data = "" .join (set (_formatInjection (_ ) for _ in kb .injections )).rstrip ("\n " )
@@ -522,6 +524,11 @@ def start():
522524
523525 setupTargetEnv ()
524526
527+ # --report-json: every tested target gets its own group with its identity, also when nothing is found
528+ # (otherwise its errors, e.g. connection failures, would have no group to land in)
529+ if conf .reportJson :
530+ conf .dumper ._reportData (_targetInfo (), CONTENT_TYPE .TARGET )
531+
525532 if not any ((conf .graphql ,)) and not checkConnection (suppressOutput = conf .forms ):
526533 continue
527534
0 commit comments