diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2023-10-11 23:16:21 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2023-10-11 23:16:21 (GMT) | 
| commit | ab6b87b7309e2d00926615f6557016bee6ab0b71 (patch) | |
| tree | bf69b93d2f0548fc845e68ae1e8519bd33d1da24 /plugins | |
| parent | 404097b7b07b336b427b3682ec2bc48d831cb2e9 (diff) | |
Add two new functions to ROST grammar: modpath and maxcommon.
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/apihashing/classics/ror13.c | 35 | ||||
| -rw-r--r-- | plugins/encodings/rost/base64.c | 35 | 
2 files changed, 70 insertions, 0 deletions
| diff --git a/plugins/apihashing/classics/ror13.c b/plugins/apihashing/classics/ror13.c index 6e063f8..1b2421d 100644 --- a/plugins/apihashing/classics/ror13.c +++ b/plugins/apihashing/classics/ror13.c @@ -62,6 +62,9 @@ static uint32_t compute_ror13(const sized_binary_t *);  /* Transforme une séquence d'octets pour motif de recherche. */  static bool g_scan_ror13_modifier_transform(const GScanRor13Modifier *, const sized_binary_t *, size_t, sized_binary_t **, size_t *); +/* Retrouve l'origine d'une correspondance à partir d'un indice. */ +static char *g_scan_ror13_modifier_get_path(const GScanRor13Modifier *, size_t *); +  /* ---------------------------------------------------------------------------------- */ @@ -100,6 +103,7 @@ static void g_scan_ror13_modifier_class_init(GScanRor13ModifierClass *klass)      modifier->get_name = (get_scan_modifier_name_fc)g_scan_ror13_modifier_get_name;      modifier->transform = (transform_scan_token_fc)g_scan_ror13_modifier_transform; +    modifier->get_path = (get_modifier_path)g_scan_ror13_modifier_get_path;  } @@ -286,3 +290,34 @@ static bool g_scan_ror13_modifier_transform(const GScanRor13Modifier *modifier,      return result;  } + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : modifier = modificateur à consulter.                         * +*                index    = indice de la combinaison ciblée. [OUT]            * +*                                                                             * +*  Description : Retrouve l'origine d'une correspondance à partir d'un indice.* +*                                                                             * +*  Retour      : Version humainement lisible de la combinaison.               * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static char *g_scan_ror13_modifier_get_path(const GScanRor13Modifier *modifier, size_t *index) +{ +    char *result;                           /* Combinaison à retourner     */ + +    if (*index > 0) +    { +        result = NULL; +        (*index)--; +    } + +    else +        result = strdup("rev"); + +    return result; + +} diff --git a/plugins/encodings/rost/base64.c b/plugins/encodings/rost/base64.c index 85e268d..15a3ec1 100644 --- a/plugins/encodings/rost/base64.c +++ b/plugins/encodings/rost/base64.c @@ -72,6 +72,9 @@ static bool g_scan_base64_modifier_can_handle_arg(const GScanBase64Modifier *, c  /* Transforme une séquence d'octets pour motif de recherche. */  static bool g_scan_base64_modifier_transform_with_arg(const GScanBase64Modifier *, const sized_binary_t *, size_t, const modifier_arg_t *, sized_binary_t **, size_t *); +/* Retrouve l'origine d'une correspondance à partir d'un indice. */ +static char *g_scan_base64_modifier_get_path(const GScanBase64Modifier *, size_t *); +  /* ---------------------------------------------------------------------------------- */ @@ -112,6 +115,7 @@ static void g_scan_base64_modifier_class_init(GScanBase64ModifierClass *klass)      modifier->transform = (transform_scan_token_fc)g_scan_base64_modifier_transform;      modifier->can_handle = (can_token_modifier_handle_arg)g_scan_base64_modifier_can_handle_arg;      modifier->transform_with = (transform_scan_token_with_fc)g_scan_base64_modifier_transform_with_arg; +    modifier->get_path = (get_modifier_path)g_scan_base64_modifier_get_path;  } @@ -511,3 +515,34 @@ static bool g_scan_base64_modifier_transform_with_arg(const GScanBase64Modifier      return result;  } + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : modifier = modificateur à consulter.                         * +*                index    = indice de la combinaison ciblée. [OUT]            * +*                                                                             * +*  Description : Retrouve l'origine d'une correspondance à partir d'un indice.* +*                                                                             * +*  Retour      : Version humainement lisible de la combinaison.               * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static char *g_scan_base64_modifier_get_path(const GScanBase64Modifier *modifier, size_t *index) +{ +    char *result;                           /* Combinaison à retourner     */ + +    if (*index > 3) +    { +        result = NULL; +        (*index) -= 3; +    } + +    else +        result = strdup("base64"); + +    return result; + +} | 
