summaryrefslogtreecommitdiff
path: root/src/analysis/scan/matches/bytes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/scan/matches/bytes.c')
-rw-r--r--src/analysis/scan/matches/bytes.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/analysis/scan/matches/bytes.c b/src/analysis/scan/matches/bytes.c
index de101c4..f0b97fe 100644
--- a/src/analysis/scan/matches/bytes.c
+++ b/src/analysis/scan/matches/bytes.c
@@ -30,6 +30,7 @@
#include "bytes-int.h"
+#include "../patterns/token.h"
#include "../../../common/cpp.h"
#include "../../../core/logs.h"
@@ -121,6 +122,8 @@ static void g_scan_bytes_match_init(GScanBytesMatch *match)
match->start = VMPA_NO_PHYSICAL;
match->len = VMPA_NO_PHYSICAL;
+ match->has_mod_path = false;
+
}
@@ -285,6 +288,59 @@ phys_t g_scan_bytes_match_get_location(const GScanBytesMatch *match, phys_t *sta
}
+/******************************************************************************
+* *
+* Paramètres : match = informations de correspondance à compléter. *
+* index = indice de la combinaison de modificateurs ciblée. *
+* *
+* Description : Mémorise l'origine d'une correspondance à partir d'un indice.*
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_scan_bytes_match_remember_modifier_path(GScanBytesMatch *match, size_t index)
+{
+ match->mod_path_index = index;
+ match->has_mod_path = true;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : match = informations de correspondance à consulter. *
+* *
+* Description : Retrouve l'origine d'une correspondance à partir d'un indice.*
+* *
+* Retour : Version humainement lisible de la combinaison gagnante. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *g_scan_bytes_match_get_modifier_path(const GScanBytesMatch *match)
+{
+ char *result; /* Combinaison à retourner */
+ GBytesToken *pattern; /* Autre version du motif */
+
+ if (match->has_mod_path)
+ {
+ pattern = G_BYTES_TOKEN(G_SCAN_MATCH(match)->source);
+ result = g_bytes_token_get_modifier_path(pattern, match->mod_path_index);
+ }
+
+ else
+ result = NULL;
+
+ return result;
+
+}
+
+
+
/* ---------------------------------------------------------------------------------- */
/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
/* ---------------------------------------------------------------------------------- */