summaryrefslogtreecommitdiff
path: root/src/analysis/scan/items
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/scan/items')
-rw-r--r--src/analysis/scan/items/Makefile.am2
-rw-r--r--src/analysis/scan/items/maxcommon.c366
-rw-r--r--src/analysis/scan/items/maxcommon.h58
-rw-r--r--src/analysis/scan/items/modpath.c301
-rw-r--r--src/analysis/scan/items/modpath.h58
5 files changed, 785 insertions, 0 deletions
diff --git a/src/analysis/scan/items/Makefile.am b/src/analysis/scan/items/Makefile.am
index 89ae41e..9263c7b 100644
--- a/src/analysis/scan/items/Makefile.am
+++ b/src/analysis/scan/items/Makefile.am
@@ -14,6 +14,8 @@ endif
libanalysisscanitems_la_SOURCES = \
count.h count.c \
datasize.h datasize.c \
+ maxcommon.h maxcommon.c \
+ modpath.h modpath.c \
uint-int.h \
uint.h uint.c
diff --git a/src/analysis/scan/items/maxcommon.c b/src/analysis/scan/items/maxcommon.c
new file mode 100644
index 0000000..a2e0f2a
--- /dev/null
+++ b/src/analysis/scan/items/maxcommon.c
@@ -0,0 +1,366 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * maxcommon.c - détermination de la plus grand occurrence au sein d'un ensemble d'éléments
+ *
+ * Copyright (C) 2023 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "maxcommon.h"
+
+
+#include <assert.h>
+#include <malloc.h>
+
+
+#include "../item-int.h"
+#include "../exprs/literal.h"
+#include "../../../glibext/comparison-int.h"
+
+
+
+/* ---------------------- INTRODUCTION D'UNE NOUVELLE FONCTION ---------------------- */
+
+
+/* Initialise la classe des repérages de plus grande occurrence. */
+static void g_scan_maxcommon_function_class_init(GScanMaxcommonFunctionClass *);
+
+/* Initialise une instance de repérage d'occurrence maximake. */
+static void g_scan_maxcommon_function_init(GScanMaxcommonFunction *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_maxcommon_function_dispose(GScanMaxcommonFunction *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_maxcommon_function_finalize(GScanMaxcommonFunction *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Indique le nom associé à une expression d'évaluation. */
+static char *g_scan_maxcommon_function_get_name(const GScanMaxcommonFunction *);
+
+/* Réduit une expression à une forme plus simple. */
+static bool g_scan_maxcommon_function_run_call(GScanMaxcommonFunction *, GScanExpression **, size_t, GScanContext *, GScanScope *, GObject **);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* INTRODUCTION D'UNE NOUVELLE FONCTION */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour un décompte d'élément le plus représenté dans une série. */
+G_DEFINE_TYPE(GScanMaxcommonFunction, g_scan_maxcommon_function, G_TYPE_SCAN_REGISTERED_ITEM);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des repérages de plus grande occurrence.*
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_maxcommon_function_class_init(GScanMaxcommonFunctionClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanRegisteredItemClass *registered; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_maxcommon_function_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_maxcommon_function_finalize;
+
+ registered = G_SCAN_REGISTERED_ITEM_CLASS(klass);
+
+ registered->get_name = (get_registered_item_name_fc)g_scan_maxcommon_function_get_name;
+ registered->run_call = (run_registered_item_call_fc)g_scan_maxcommon_function_run_call;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : func = instance à initialiser. *
+* *
+* Description : Initialise une instance de repérage d'occurrence maximake. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_maxcommon_function_init(GScanMaxcommonFunction *func)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : func = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_maxcommon_function_dispose(GScanMaxcommonFunction *func)
+{
+ G_OBJECT_CLASS(g_scan_maxcommon_function_parent_class)->dispose(G_OBJECT(func));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : func = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_maxcommon_function_finalize(GScanMaxcommonFunction *func)
+{
+ G_OBJECT_CLASS(g_scan_maxcommon_function_parent_class)->finalize(G_OBJECT(func));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Constitue une fonction de calcul de plus grande occurrence. *
+* *
+* Retour : Fonction mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanRegisteredItem *g_scan_maxcommon_function_new(void)
+{
+ GScanRegisteredItem *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_MAXCOMMON_FUNCTION, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : item = élément d'appel à consulter. *
+* *
+* Description : Indique le nom associé à une expression d'évaluation. *
+* *
+* Retour : Désignation humaine de l'expression d'évaluation. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_maxcommon_function_get_name(const GScanMaxcommonFunction *item)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("maxcommon");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = élément d'appel à consulter. *
+* args = liste d'éventuels arguments fournis. *
+* count = taille de cette liste. *
+* ctx = contexte de suivi de l'analyse courante. *
+* scope = portée courante des variables locales. *
+* out = zone d'enregistrement de la résolution opérée. [OUT] *
+* *
+* Description : Réduit une expression à une forme plus simple. *
+* *
+* Retour : Réduction correspondante, expression déjà réduite, ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_maxcommon_function_run_call(GScanMaxcommonFunction *item, GScanExpression **args, size_t count, GScanContext *ctx, GScanScope *scope, GObject **out)
+{
+ bool result; /* Bilan à retourner */
+ size_t used; /* Prochain emplacement libre */
+ GScanExpression **collected; /* Représentants de groupes */
+ size_t *scores; /* Taille de ces groupes */
+ size_t i; /* Boucle de parcours #1 */
+ size_t k; /* Boucle de parcours #2 */
+ bool status; /* Bilan de la comparaison */
+ bool equal; /* Egalité établie ? */
+ size_t arg0_count; /* Taille de l'argument unique */
+ GScanExpression *arg0_item; /* Elément de cet argument */
+ size_t best; /* Meilleur score identifié */
+
+ result = (count > 0);
+ if (!result) goto exit;
+
+ used = 0;
+
+ /* Si la série à étudier est directement fournie */
+ if (count > 1)
+ {
+ collected = malloc(count * sizeof(GScanExpression *));
+ scores = malloc(count * sizeof(size_t));
+
+ for (i = 0; i < count; i++)
+ {
+ for (k = 0; k < used; k++)
+ {
+ status = g_comparable_item_compare_rich(G_COMPARABLE_ITEM(args[i]),
+ G_COMPARABLE_ITEM(collected[k]),
+ RCO_EQ, &equal);
+
+ if (status && equal)
+ break;
+
+ }
+
+ if (k < used)
+ scores[k]++;
+
+ else
+ {
+ collected[used] = args[i];
+ g_object_ref(G_OBJECT(args[i]));
+ scores[used] = 1;
+
+ used++;
+
+ }
+
+ }
+
+ }
+
+ /* Sinon on considère que l'arguement unique porte la liste (idéalement) */
+ else
+ {
+ if (G_IS_SCAN_LITERAL_EXPRESSION(args[0]) || !g_scan_expression_handle_set_features(args[0]))
+ {
+ best = 1;
+ goto quick_unique;
+ }
+
+#ifndef NDEBUG
+ g_scan_expression_count_items(args[0], ctx, &arg0_count);
+#else
+ status = bool g_scan_expression_count_items(args[0], ctx, &arg0_count);
+ assert(status);
+#endif
+
+ collected = malloc(arg0_count * sizeof(GScanExpression *));
+ scores = malloc(arg0_count * sizeof(size_t));
+
+ for (i = 0; i < arg0_count; i++)
+ {
+#ifndef NDEBUG
+ g_scan_expression_get_item(args[0], i, ctx, &arg0_item);
+#else
+ status = g_scan_expression_get_item(args[0], i, ctx, &arg0_item);
+ assert(status);
+#endif
+
+ for (k = 0; k < used; k++)
+ {
+ status = g_comparable_item_compare_rich(G_COMPARABLE_ITEM(arg0_item),
+ G_COMPARABLE_ITEM(collected[k]),
+ RCO_EQ, &equal);
+
+ if (status && equal)
+ break;
+
+ }
+
+ if (k < used)
+ {
+ g_object_unref(G_OBJECT(arg0_item));
+ scores[k]++;
+ }
+
+ else
+ {
+ collected[used] = arg0_item;
+ scores[used] = 1;
+
+ used++;
+
+ }
+
+ }
+
+ }
+
+ /* Analyse des résultats */
+
+ best = 0;
+
+ for (i = 0; i < used; i++)
+ if (scores[i] > best)
+ best = scores[i];
+
+ for (i = 0; i < used; i++)
+ g_object_unref(G_OBJECT(collected[i]));
+
+ free(collected);
+ free(scores);
+
+ quick_unique:
+
+ assert(best > 0);
+
+ *out = G_OBJECT(g_scan_literal_expression_new(LVT_UNSIGNED_INTEGER, (unsigned long long []){ best }));
+
+ exit:
+
+ return result;
+
+}
diff --git a/src/analysis/scan/items/maxcommon.h b/src/analysis/scan/items/maxcommon.h
new file mode 100644
index 0000000..a834c00
--- /dev/null
+++ b/src/analysis/scan/items/maxcommon.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * maxcommon.h - prototypes pour la détermination de la plus grand occurrence au sein d'un ensemble d'éléments
+ *
+ * Copyright (C) 2023 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _ANALYSIS_SCAN_ITEMS_MAXCOMMON_H
+#define _ANALYSIS_SCAN_ITEMS_MAXCOMMON_H
+
+
+#include <glib-object.h>
+
+
+#include "../item.h"
+
+
+
+#define G_TYPE_SCAN_MAXCOMMON_FUNCTION g_scan_maxcommon_function_get_type()
+#define G_SCAN_MAXCOMMON_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_MAXCOMMON_FUNCTION, GScanMaxcommonFunction))
+#define G_IS_SCAN_MAXCOMMON_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_MAXCOMMON_FUNCTION))
+#define G_SCAN_MAXCOMMON_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_MAXCOMMON_FUNCTION, GScanMaxcommonFunctionClass))
+#define G_IS_SCAN_MAXCOMMON_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_MAXCOMMON_FUNCTION))
+#define G_SCAN_MAXCOMMON_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_MAXCOMMON_FUNCTION, GScanMaxcommonFunctionClass))
+
+
+/* Détermination de la plus grand occurrence au sein d'un ensemble (instance) */
+typedef GScanRegisteredItem GScanMaxcommonFunction;
+
+/* Détermination de la plus grand occurrence au sein d'un ensemble (classe) */
+typedef GScanRegisteredItemClass GScanMaxcommonFunctionClass;
+
+
+/* Indique le type défini pour un décompte d'élément le plus représenté dans une série. */
+GType g_scan_maxcommon_function_get_type(void);
+
+/* Constitue une fonction de calcul de plus grande occurrence. */
+GScanRegisteredItem *g_scan_maxcommon_function_new(void);
+
+
+
+#endif /* _ANALYSIS_SCAN_ITEMS_MAXCOMMON_H */
diff --git a/src/analysis/scan/items/modpath.c b/src/analysis/scan/items/modpath.c
new file mode 100644
index 0000000..2171bda
--- /dev/null
+++ b/src/analysis/scan/items/modpath.c
@@ -0,0 +1,301 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * modpath.c - récupération des combinaisons de modification de motifs
+ *
+ * Copyright (C) 2023 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "modpath.h"
+
+
+#include "../item-int.h"
+
+
+#include "../exprs/handler.h"
+#include "../exprs/literal.h"
+#include "../exprs/set.h"
+#include "../matches/bytes.h"
+
+
+
+/* ---------------------- INTRODUCTION D'UNE NOUVELLE FONCTION ---------------------- */
+
+
+/* Initialise la classe des énumérations de formules de motifs. */
+static void g_scan_modpath_function_class_init(GScanModpathFunctionClass *);
+
+/* Initialise une instance d'énumération de formules de motifs. */
+static void g_scan_modpath_function_init(GScanModpathFunction *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_modpath_function_dispose(GScanModpathFunction *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_modpath_function_finalize(GScanModpathFunction *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Indique le nom associé à une expression d'évaluation. */
+static char *g_scan_modpath_function_get_name(const GScanModpathFunction *);
+
+/* Réduit une expression à une forme plus simple. */
+static bool g_scan_modpath_function_run_call(GScanModpathFunction *, GScanExpression **, size_t, GScanContext *, GScanScope *, GObject **);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* INTRODUCTION D'UNE NOUVELLE FONCTION */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une énumération de formules créant des motifs. */
+G_DEFINE_TYPE(GScanModpathFunction, g_scan_modpath_function, G_TYPE_SCAN_REGISTERED_ITEM);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des énumérations de formules de motifs. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_modpath_function_class_init(GScanModpathFunctionClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanRegisteredItemClass *registered; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_modpath_function_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_modpath_function_finalize;
+
+ registered = G_SCAN_REGISTERED_ITEM_CLASS(klass);
+
+ registered->get_name = (get_registered_item_name_fc)g_scan_modpath_function_get_name;
+ registered->run_call = (run_registered_item_call_fc)g_scan_modpath_function_run_call;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : func = instance à initialiser. *
+* *
+* Description : Initialise une instance d'énumération de formules de motifs. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_modpath_function_init(GScanModpathFunction *func)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : func = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_modpath_function_dispose(GScanModpathFunction *func)
+{
+ G_OBJECT_CLASS(g_scan_modpath_function_parent_class)->dispose(G_OBJECT(func));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : func = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_modpath_function_finalize(GScanModpathFunction *func)
+{
+ G_OBJECT_CLASS(g_scan_modpath_function_parent_class)->finalize(G_OBJECT(func));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Constitue une fonction d'énumération des formules de motifs. *
+* *
+* Retour : Fonction mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanRegisteredItem *g_scan_modpath_function_new(void)
+{
+ GScanRegisteredItem *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_MODPATH_FUNCTION, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : item = élément d'appel à consulter. *
+* *
+* Description : Indique le nom associé à une expression d'évaluation. *
+* *
+* Retour : Désignation humaine de l'expression d'évaluation. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_modpath_function_get_name(const GScanModpathFunction *item)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("modpath");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = élément d'appel à consulter. *
+* args = liste d'éventuels arguments fournis. *
+* count = taille de cette liste. *
+* ctx = contexte de suivi de l'analyse courante. *
+* scope = portée courante des variables locales. *
+* out = zone d'enregistrement de la résolution opérée. [OUT] *
+* *
+* Description : Réduit une expression à une forme plus simple. *
+* *
+* Retour : Réduction correspondante, expression déjà réduite, ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_modpath_function_run_call(GScanModpathFunction *item, GScanExpression **args, size_t count, GScanContext *ctx, GScanScope *scope, GObject **out)
+{
+ bool result; /* Bilan à retourner */
+ size_t i; /* Boucle de parcours #1 */
+ size_t mcount; /* Quantité de correspondances */
+ GScanMatch **matches; /* Correspondances établies */
+ size_t k; /* Boucle de parcours #2 */
+ sized_string_t path; /* Combinaison à conserver */
+ GScanExpression *subitem; /* Nouvel élément à transmettre*/
+
+ /* Validation préalable du type des arguments */
+
+ result = true;
+
+ for (i = 0; i < count && result; i++)
+ result = G_IS_SCAN_PATTERN_HANDLER(args[i]);
+
+ if (!result)
+ goto exit;
+
+ /* Construction des chemins attendus */
+
+ *out = G_OBJECT(g_scan_generic_set_new());
+
+ for (i = 0; i < count; i++)
+ {
+ matches = g_scan_pattern_handler_get_all_matches(G_SCAN_PATTERN_HANDLER(args[i]), ctx, &mcount);
+ if (mcount == 0) continue;
+
+ /**
+ * La série est à priori constituée d'éléments de même type, donc
+ * un test unique suffit.
+ */
+ if (!G_IS_SCAN_BYTES_MATCH(matches[0]))
+ {
+ for (k = 0; k < mcount; k++)
+ g_object_unref(G_OBJECT(matches[k]));
+ }
+
+ else
+ {
+ for (k = 0; k < mcount; k++)
+ {
+ path.data = g_scan_bytes_match_get_modifier_path(G_SCAN_BYTES_MATCH(matches[k]));
+ if (path.data == NULL) continue;
+
+ path.len = strlen(path.data);
+
+ printf(" >> add '%s'\n", path.data);
+
+ subitem = g_scan_literal_expression_new(LVT_STRING, &path);
+
+ g_scan_generic_set_add_item(G_SCAN_GENERIC_SET(*out), subitem);
+
+ g_object_unref(G_OBJECT(subitem));
+
+ exit_szstr(&path);
+
+ g_object_unref(G_OBJECT(matches[k]));
+
+ }
+
+ }
+
+ free(matches);
+
+ }
+
+ exit:
+
+ return result;
+
+}
diff --git a/src/analysis/scan/items/modpath.h b/src/analysis/scan/items/modpath.h
new file mode 100644
index 0000000..3a78ef7
--- /dev/null
+++ b/src/analysis/scan/items/modpath.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * modpath.h - prototypes pour la récupération des combinaisons de modification de motifs
+ *
+ * Copyright (C) 2023 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Chrysalide is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _ANALYSIS_SCAN_ITEMS_MODPATH_H
+#define _ANALYSIS_SCAN_ITEMS_MODPATH_H
+
+
+#include <glib-object.h>
+
+
+#include "../item.h"
+
+
+
+#define G_TYPE_SCAN_MODPATH_FUNCTION g_scan_modpath_function_get_type()
+#define G_SCAN_MODPATH_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_MODPATH_FUNCTION, GScanModpathFunction))
+#define G_IS_SCAN_MODPATH_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_MODPATH_FUNCTION))
+#define G_SCAN_MODPATH_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_MODPATH_FUNCTION, GScanModpathFunctionClass))
+#define G_IS_SCAN_MODPATH_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_MODPATH_FUNCTION))
+#define G_SCAN_MODPATH_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_MODPATH_FUNCTION, GScanModpathFunctionClass))
+
+
+/* Récupération de formules à l'origine de la construction de motifs (instance) */
+typedef GScanRegisteredItem GScanModpathFunction;
+
+/* Récupération de formules à l'origine de la construction de motifs (classe) */
+typedef GScanRegisteredItemClass GScanModpathFunctionClass;
+
+
+/* Indique le type défini pour une énumération de formules créant des motifs. */
+GType g_scan_modpath_function_get_type(void);
+
+/* Constitue une fonction d'énumération des formules de motifs. */
+GScanRegisteredItem *g_scan_modpath_function_new(void);
+
+
+
+#endif /* _ANALYSIS_SCAN_ITEMS_MODPATH_H */