summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/analysis/scan/matches/bytes.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/analysis/scan/matches/bytes.c b/src/analysis/scan/matches/bytes.c
index ccd73a1..de101c4 100644
--- a/src/analysis/scan/matches/bytes.c
+++ b/src/analysis/scan/matches/bytes.c
@@ -459,6 +459,7 @@ static void g_scan_bytes_match_output_to_json(const GScanBytesMatch *match, cons
init_vmpa(&pos, match->start, VMPA_NO_VIRTUAL);
data = g_binary_content_get_raw_access(match->content, &pos, match->len);
+ assert(data != NULL);
for (k = 0; k < match->len; k++)
{
@@ -505,6 +506,7 @@ static void g_scan_bytes_match_output_to_json(const GScanBytesMatch *match, cons
init_vmpa(&pos, match->start, VMPA_NO_VIRTUAL);
data = g_binary_content_get_raw_access(match->content, &pos, match->len);
+ assert(data != NULL);
for (k = 0; k < match->len; k++)
{
@@ -536,6 +538,50 @@ static void g_scan_bytes_match_output_to_json(const GScanBytesMatch *match, cons
}
- write(fd, "\"\n", 2);
+ write(fd, "\",\n", 3);
+
+ /* Affichage du contenu brut */
+
+ for (i = 0; i < level; i++)
+ write(fd, padding->data, padding->len);
+
+ write(fd, "\"length\": ", 10);
+
+ init_vmpa(&pos, match->start, VMPA_NO_VIRTUAL);
+
+ ret = snprintf(value, ULLONG_MAXLEN, "%llu", (unsigned long long)match->len);
+
+ if (ret > 0)
+ write(fd, value, ret);
+
+ else
+ {
+ log_simple_message(LMT_EXT_ERROR, "Error while converting data!");
+ write(fd, "-1", 2);
+ }
+
+ write(fd, ",\n", 2);
+
+ /* Affichage du contenu brut (hexadécimal) */
+
+ for (i = 0; i < level; i++)
+ write(fd, padding->data, padding->len);
+
+ write(fd, "\"length_hex\": ", 14);
+
+ init_vmpa(&pos, match->start, VMPA_NO_VIRTUAL);
+
+ ret = snprintf(value, ULLONG_MAXLEN, "\"0x%llx\"", (unsigned long long)match->len);
+
+ if (ret > 0)
+ write(fd, value, ret);
+
+ else
+ {
+ log_simple_message(LMT_EXT_ERROR, "Error while converting data!");
+ write(fd, "\"0xffffffffffffffff\"", 20);
+ }
+
+ write(fd, "\n", 1);
}