From 980aa6724a3bdd735742c74e7bb84627a88b4532 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Thu, 28 Sep 2023 01:30:39 +0200 Subject: Include the scan target in JSON results. --- src/analysis/scan/rule.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/analysis/scan/rule.c b/src/analysis/scan/rule.c index 650b824..60842c2 100644 --- a/src/analysis/scan/rule.c +++ b/src/analysis/scan/rule.c @@ -817,6 +817,8 @@ void g_scan_rule_output_to_json(const GScanRule *rule, GScanContext *context, co size_t i; /* Boucle de parcours #1 */ bool sub_tail; /* Saut de la virgule finale ? */ size_t k; /* Boucle de parcours #2 */ + GBinContent *content; /* Contenu binaire scanné */ + char *desc; /* Description de ce contenu */ /* Introduction */ @@ -872,6 +874,25 @@ void g_scan_rule_output_to_json(const GScanRule *rule, GScanContext *context, co write(fd, "],\n", 3); + /* Cible du scan */ + + for (i = 0; i < (level + 1); i++) + write(fd, padding->data, padding->len); + + write(fd, "\"target\": \"", 11); + + content = g_scan_context_get_content(context); + + desc = g_binary_content_describe(content, true); + + write(fd, desc, strlen(desc)); + + free(desc); + + g_object_unref(G_OBJECT(content)); + + write(fd, "\",\n", 3); + /* Affichage des correspondances d'octets */ for (i = 0; i < (level + 1); i++) -- cgit v0.11.2-87-g4458