summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-09-27 23:30:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-09-27 23:30:39 (GMT)
commit980aa6724a3bdd735742c74e7bb84627a88b4532 (patch)
tree4ce23030cd9914b8cd30e7f22f05bbcaeb1b9216 /src/analysis
parent641761e51672fa33f27acdcdb40b46b506ab07dc (diff)
Include the scan target in JSON results.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/scan/rule.c21
1 files changed, 21 insertions, 0 deletions
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++)