diff options
Diffstat (limited to 'src/analysis/scan/patterns/tokens/nodes/plain.c')
-rw-r--r-- | src/analysis/scan/patterns/tokens/nodes/plain.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/analysis/scan/patterns/tokens/nodes/plain.c b/src/analysis/scan/patterns/tokens/nodes/plain.c index 5d89cf8..7309574 100644 --- a/src/analysis/scan/patterns/tokens/nodes/plain.c +++ b/src/analysis/scan/patterns/tokens/nodes/plain.c @@ -277,6 +277,35 @@ ScanPlainNodeFlags g_scan_token_node_plain_get_flags(const GScanTokenNodePlain * } +/****************************************************************************** +* * +* Paramètres : node = définition de la bribe à consulter. * +* index = indice de la combinaison de modificateurs ciblée. * +* * +* Description : Retrouve l'origine d'une correspondance à partir d'un indice.* +* * +* Retour : Version humainement lisible de la combinaison. * +* * +* Remarques : - * +* * +******************************************************************************/ + +char *g_scan_token_node_plain_get_modifier_path(const GScanTokenNodePlain *node, size_t index) +{ + char *result; /* Combinaison à retourner */ + + if (node->modifier == NULL) + result = strdup("plain"); + + else + result = g_scan_token_modifier_get_path(node->modifier, (size_t []){ index }); + + return result; + + +} + + /* ---------------------------------------------------------------------------------- */ /* IMPLEMENTATION DES FONCTIONS DE CLASSE */ @@ -511,6 +540,7 @@ static bool check_scan_token_node_plain_content(const sized_binary_t *raw, const static void g_scan_token_node_plain_check_forward(const GScanTokenNodePlain *node, GScanContext *context, GBinContent *content, pending_matches_t *matches, node_search_offset_t *offset, bool not, bool *skip) { bool initialized; /* Initialisation du suivi ? */ + bool track_path; /* Conservation du chemin */ bool nocase; /* Pas d'intérêt pour la casse */ size_t ocount; /* Quantité de bornes présentes*/ size_t i; /* Boucle de parcours #1 */ @@ -531,6 +561,10 @@ static void g_scan_token_node_plain_check_forward(const GScanTokenNodePlain *nod initialized = are_pending_matches_initialized(matches); + track_path = (G_SCAN_TOKEN_NODE(node)->flags & STNF_MAIN); + + assert((track_path && !initialized) || !track_path); + nocase = (node->flags & SPNF_CASE_INSENSITIVE); get_node_search_offset_ranges(offset, &ocount); @@ -568,12 +602,18 @@ static void g_scan_token_node_plain_check_forward(const GScanTokenNodePlain *nod status = check_scan_token_node_plain_content(raw, atom, nocase, new_begin, content); if ((status && !not) || (!status && not)) + { /** * Il ne peut y avoir qu'une seule séquence d'octets à un même * emplacement, donc le couple (new_begin, len) enregistré est * unique. */ - add_pending_match(matches, new_begin, raw->len); + if (track_path) + add_pending_match_with_path(matches, new_begin, raw->len, i); + else + add_pending_match(matches, new_begin, raw->len); + + } } |