summaryrefslogtreecommitdiff
path: root/plugins/apihashing/custom
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/apihashing/custom')
-rw-r--r--plugins/apihashing/custom/Makefile.am18
-rw-r--r--plugins/apihashing/custom/add1505-shl5.c325
-rw-r--r--plugins/apihashing/custom/add1505-shl5.h58
-rw-r--r--plugins/apihashing/custom/enigma-murmur.c377
-rw-r--r--plugins/apihashing/custom/enigma-murmur.h58
-rw-r--r--plugins/apihashing/custom/imul21-add.c326
-rw-r--r--plugins/apihashing/custom/imul21-add.h58
-rw-r--r--plugins/apihashing/custom/imul83-add.c326
-rw-r--r--plugins/apihashing/custom/imul83-add.h58
-rw-r--r--plugins/apihashing/custom/sll1-add-hash32.c326
-rw-r--r--plugins/apihashing/custom/sll1-add-hash32.h58
-rw-r--r--plugins/apihashing/custom/sub-index1.c291
-rw-r--r--plugins/apihashing/custom/sub-index1.h58
-rw-r--r--plugins/apihashing/custom/sub42.c291
-rw-r--r--plugins/apihashing/custom/sub42.h58
15 files changed, 2686 insertions, 0 deletions
diff --git a/plugins/apihashing/custom/Makefile.am b/plugins/apihashing/custom/Makefile.am
new file mode 100644
index 0000000..026addc
--- /dev/null
+++ b/plugins/apihashing/custom/Makefile.am
@@ -0,0 +1,18 @@
+
+noinst_LTLIBRARIES = libapihashingcustom.la
+
+libapihashingcustom_la_SOURCES = \
+ add1505-shl5.h add1505-shl5.c \
+ enigma-murmur.h enigma-murmur.c \
+ imul21-add.h imul21-add.c \
+ imul83-add.h imul83-add.c \
+ sll1-add-hash32.h sll1-add-hash32.c \
+ sub-index1.h sub-index1.c \
+ sub42.h sub42.c
+
+libapihashingcustom_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) -I$(top_srcdir)/src
+
+
+devdir = $(includedir)/chrysalide-$(subdir)
+
+dev_HEADERS = $(libapihashingcustom_la_SOURCES:%c=)
diff --git a/plugins/apihashing/custom/add1505-shl5.c b/plugins/apihashing/custom/add1505-shl5.c
new file mode 100644
index 0000000..db96cf1
--- /dev/null
+++ b/plugins/apihashing/custom/add1505-shl5.c
@@ -0,0 +1,325 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * add1505-shl5.c - transormation en empreinte d'API add1505-shl5
+ *
+ * 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 "add1505-shl5.h"
+
+
+#include <malloc.h>
+
+
+#include <analysis/scan/patterns/modifier-int.h>
+
+
+
+
+/* ----------------------- RECHERCHE D'UN MOTIF DE TEXTE BRUT ----------------------- */
+
+
+/* Initialise la classe des transmissions en empreintes add1505-shl5. */
+static void g_scan_add1505_shl5_modifier_class_init(GScanAdd1505Shl5ModifierClass *);
+
+/* Initialise une instance de transmission en empreinte add1505-shl5. */
+static void g_scan_add1505_shl5_modifier_init(GScanAdd1505Shl5Modifier *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_add1505_shl5_modifier_dispose(GScanAdd1505Shl5Modifier *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_add1505_shl5_modifier_finalize(GScanAdd1505Shl5Modifier *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Fournit le nom d'appel d'un modificateur pour motif. */
+static char *g_scan_add1505_shl5_modifier_get_name(const GScanAdd1505Shl5Modifier *);
+
+/* Calcule l'empreinte add1505-shl5 d'un motif de recherche. */
+static uint32_t compute_add1505_shl5_hash32(const sized_binary_t *);
+
+/* Transforme une séquence d'octets pour motif de recherche. */
+static bool g_scan_add1505_shl5_modifier_transform(const GScanAdd1505Shl5Modifier *, 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_add1505_shl5_modifier_get_path(const GScanAdd1505Shl5Modifier *, size_t *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* RECHERCHE D'UN MOTIF DE TEXTE BRUT */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une transormation en empreinte add1505-shl5. */
+G_DEFINE_TYPE(GScanAdd1505Shl5Modifier, g_scan_add1505_shl5_modifier, G_TYPE_API_HASH_MODIFIER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des transmissions en empreintes add1505-shl5. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_add1505_shl5_modifier_class_init(GScanAdd1505Shl5ModifierClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanTokenModifierClass *modifier; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_add1505_shl5_modifier_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_add1505_shl5_modifier_finalize;
+
+ modifier = G_SCAN_TOKEN_MODIFIER_CLASS(klass);
+
+ modifier->get_name = (get_scan_modifier_name_fc)g_scan_add1505_shl5_modifier_get_name;
+
+ modifier->transform = (transform_scan_token_fc)g_scan_add1505_shl5_modifier_transform;
+ modifier->get_path = (get_modifier_path)g_scan_add1505_shl5_modifier_get_path;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance à initialiser. *
+* *
+* Description : Initialise une instance de transmission en empreinte add1505-shl5. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_add1505_shl5_modifier_init(GScanAdd1505Shl5Modifier *modifier)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_add1505_shl5_modifier_dispose(GScanAdd1505Shl5Modifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_add1505_shl5_modifier_parent_class)->dispose(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_add1505_shl5_modifier_finalize(GScanAdd1505Shl5Modifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_add1505_shl5_modifier_parent_class)->finalize(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit un modificateur livrant des empreintes add1505-shl5. *
+* *
+* Retour : Mécanisme mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanTokenModifier *g_scan_add1505_shl5_modifier_new(void)
+{
+ GScanTokenModifier *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_ADD1505_SHL5_MODIFIER, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à consulter. *
+* *
+* Description : Fournit le nom d'appel d'un modificateur pour motif. *
+* *
+* Retour : Désignation humaine. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_add1505_shl5_modifier_get_name(const GScanAdd1505Shl5Modifier *modifier)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("add1505-shl5");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : src = séquence d'octets à traiter. *
+* *
+* Description : Calcule l'empreinte add1505-shl5 d'un motif de recherche. *
+* *
+* Retour : Valeur entière de l'empreinte déterminée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static uint32_t compute_add1505_shl5_hash32(const sized_binary_t *src)
+{
+ uint32_t result; /* Valeur à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = 0x1505;
+
+ for (i = 0; i < src->len; i++)
+ {
+ result += (result << 5);
+ result += src->data[i];
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à solliciter. *
+* src = séquences d'octets à traiter. *
+* scount = quantité de ces séquences. *
+* dest = nouvelle(s) séquence(s) d'octets obtenue(s) [OUT] *
+* dcount = quantité de ces séquences. *
+* *
+* Description : Transforme une séquence d'octets pour motif de recherche. *
+* *
+* Retour : Bilan de l'opération : succès ou échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_add1505_shl5_modifier_transform(const GScanAdd1505Shl5Modifier *modifier, const sized_binary_t *src, size_t scount, sized_binary_t **dest, size_t *dcount)
+{
+ bool result; /* Bilan d'opération à renvoyer*/
+ sized_binary_t *binary; /* Raccourci vers le stockage */
+ size_t i; /* Boucle de parcours #1 */
+ const sized_binary_t *_src; /* Source courante */
+ uint32_t hash; /* Valeur d'empreinte calculée */
+
+ result = true;
+
+ *dcount = scount;
+ *dest = calloc(*dcount, sizeof(sized_binary_t));
+
+ binary = &(*dest)[0];
+
+ for (i = 0; i < scount; i++, binary++)
+ {
+ _src = src + i;
+
+ hash = compute_add1505_shl5_hash32(_src);
+
+ binary->data = malloc(sizeof(hash) * sizeof(bin_t));
+ binary->len = sizeof(hash);
+
+ memcpy(binary->data, &hash, sizeof(hash));
+
+ }
+
+ 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_add1505_shl5_modifier_get_path(const GScanAdd1505Shl5Modifier *modifier, size_t *index)
+{
+ char *result; /* Combinaison à retourner */
+
+ if (*index > 0)
+ {
+ result = NULL;
+ (*index)--;
+ }
+
+ else
+ result = strdup("add1505-shl5");
+
+ return result;
+
+}
diff --git a/plugins/apihashing/custom/add1505-shl5.h b/plugins/apihashing/custom/add1505-shl5.h
new file mode 100644
index 0000000..5e71987
--- /dev/null
+++ b/plugins/apihashing/custom/add1505-shl5.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * add1505-shl5.h - prototypes pour la transormation en empreinte d'API add1505-shl5
+ *
+ * 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 _PLUGINS_APIHASHING_CUSTOM_ADD1505_SHL5_H
+#define _PLUGINS_APIHASHING_CUSTOM_ADD1505_SHL5_H
+
+
+#include <glib-object.h>
+
+
+#include "../apihash.h"
+
+
+
+#define G_TYPE_SCAN_ADD1505_SHL5_MODIFIER g_scan_add1505_shl5_modifier_get_type()
+#define G_SCAN_ADD1505_SHL5_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_ADD1505_SHL5_MODIFIER, GScanAdd1505Shl5Modifier))
+#define G_IS_SCAN_ADD1505_SHL5_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_ADD1505_SHL5_MODIFIER))
+#define G_SCAN_ADD1505_SHL5_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_ADD1505_SHL5_MODIFIER, GScanAdd1505Shl5ModifierClass))
+#define G_IS_SCAN_ADD1505_SHL5_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_ADD1505_SHL5_MODIFIER))
+#define G_SCAN_ADD1505_SHL5_MODIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_ADD1505_SHL5_MODIFIER, GScanAdd1505Shl5ModifierClass))
+
+
+/* Transormation en empreinte d'API add1505-shl5 (instance) */
+typedef GApiHashModifier GScanAdd1505Shl5Modifier;
+
+/* Transormation en empreinte d'API add1505-shl5 (classe) */
+typedef GApiHashModifierClass GScanAdd1505Shl5ModifierClass;
+
+
+/* Indique le type défini pour une transormation en empreinte add1505-shl5. */
+GType g_scan_add1505_shl5_modifier_get_type(void);
+
+/* Construit un modificateur livrant des empreintes add1505-shl5. */
+GScanTokenModifier *g_scan_add1505_shl5_modifier_new(void);
+
+
+
+#endif /* _PLUGINS_APIHASHING_CUSTOM_ADD1505_SHL5_H */
diff --git a/plugins/apihashing/custom/enigma-murmur.c b/plugins/apihashing/custom/enigma-murmur.c
new file mode 100644
index 0000000..cdc35b0
--- /dev/null
+++ b/plugins/apihashing/custom/enigma-murmur.c
@@ -0,0 +1,377 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * enigma-murmur.c - transormation en empreinte d'API enigma-murmur
+ *
+ * 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 "enigma-murmur.h"
+
+
+#include <malloc.h>
+
+
+#include <analysis/scan/patterns/modifier-int.h>
+
+
+
+
+/* ----------------------- RECHERCHE D'UN MOTIF DE TEXTE BRUT ----------------------- */
+
+
+/* Initialise la classe des empreintes enigma-murmur. */
+static void g_scan_enigma_murmur_modifier_class_init(GScanEnigmaMurmurModifierClass *);
+
+/* Initialise une instance d'empreinte enigma-murmur. */
+static void g_scan_enigma_murmur_modifier_init(GScanEnigmaMurmurModifier *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_enigma_murmur_modifier_dispose(GScanEnigmaMurmurModifier *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_enigma_murmur_modifier_finalize(GScanEnigmaMurmurModifier *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Fournit le nom d'appel d'un modificateur pour motif. */
+static char *g_scan_enigma_murmur_modifier_get_name(const GScanEnigmaMurmurModifier *);
+
+/* Calcule l'empreinte enigma-murmur d'un motif de recherche. */
+static uint32_t compute_enigma_murmur_hash32(const sized_binary_t *);
+
+/* Transforme une séquence d'octets pour motif de recherche. */
+static bool g_scan_enigma_murmur_modifier_transform(const GScanEnigmaMurmurModifier *, 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_enigma_murmur_modifier_get_path(const GScanEnigmaMurmurModifier *, size_t *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* RECHERCHE D'UN MOTIF DE TEXTE BRUT */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une transormation en empreinte enigma-murmur. */
+G_DEFINE_TYPE(GScanEnigmaMurmurModifier, g_scan_enigma_murmur_modifier, G_TYPE_API_HASH_MODIFIER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des empreintes enigma-murmur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_enigma_murmur_modifier_class_init(GScanEnigmaMurmurModifierClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanTokenModifierClass *modifier; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_enigma_murmur_modifier_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_enigma_murmur_modifier_finalize;
+
+ modifier = G_SCAN_TOKEN_MODIFIER_CLASS(klass);
+
+ modifier->get_name = (get_scan_modifier_name_fc)g_scan_enigma_murmur_modifier_get_name;
+
+ modifier->transform = (transform_scan_token_fc)g_scan_enigma_murmur_modifier_transform;
+ modifier->get_path = (get_modifier_path)g_scan_enigma_murmur_modifier_get_path;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance à initialiser. *
+* *
+* Description : Initialise une instance d'empreinte enigma-murmur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_enigma_murmur_modifier_init(GScanEnigmaMurmurModifier *modifier)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_enigma_murmur_modifier_dispose(GScanEnigmaMurmurModifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_enigma_murmur_modifier_parent_class)->dispose(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_enigma_murmur_modifier_finalize(GScanEnigmaMurmurModifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_enigma_murmur_modifier_parent_class)->finalize(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit un modificateur pour des empreintes enigma-murmur. *
+* *
+* Retour : Mécanisme mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanTokenModifier *g_scan_enigma_murmur_modifier_new(void)
+{
+ GScanTokenModifier *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_ENIGMA_MURMUR_MODIFIER, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à consulter. *
+* *
+* Description : Fournit le nom d'appel d'un modificateur pour motif. *
+* *
+* Retour : Désignation humaine. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_enigma_murmur_modifier_get_name(const GScanEnigmaMurmurModifier *modifier)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("enigma-murmur");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : src = séquence d'octets à traiter. *
+* *
+* Description : Calcule l'empreinte enigma-murmur d'un motif de recherche. *
+* *
+* Retour : Valeur entière de l'empreinte déterminée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static uint32_t compute_enigma_murmur_hash32(const sized_binary_t *src)
+{
+ uint32_t result; /* Valeur à retourner */
+ size_t blk_count; /* Nombre de blocs présents */
+ size_t i; /* Boucle de parcours */
+ uint32_t k; /* Valeur pour un bloc */
+ const bin_t *tail; /* Fragement de bloc final */
+
+ result = 0x4a03bdfa;
+
+ /* Traitement par blocs de 4 octets */
+
+ blk_count = src->len / 4;
+
+ for (i = 0; i < blk_count; i++)
+ {
+ k = ((uint32_t *)src->data)[i];
+
+ k *= 0xcc9e2d51;
+ k = (k << 15) | (k >> 17);
+ k *= 0x1b873593;
+
+ result ^= k;
+ result = (result << 13) | (result >> 19);
+ result = result * 5 + 0xe6546b64;
+
+ }
+
+ /* Traitement du reste */
+
+ tail = src->static_bin_data + 4 * blk_count;
+
+ k = 0;
+
+ switch (src->len & 3)
+ {
+ case 3:
+ k ^= (tail[2] << 16);
+
+ case 2:
+ k ^= (tail[1] << 8);
+
+ case 1:
+ k ^= tail[0];
+ k *= 0xcc9e2d51;
+ k = (k << 15) | (k >> (17));
+ k *= 0x1b873593;
+ result ^= k;
+ break;
+
+ case 0:
+ break;
+
+ }
+
+ /* Conclusion */
+
+ result ^= src->len;
+
+ result ^= (result >> 16);
+ result *= 0x85ebca6b;
+ result ^= (result >> 13);
+ result *= 0xc2b2ae35;
+ result ^= (result >> 16);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à solliciter. *
+* src = séquences d'octets à traiter. *
+* scount = quantité de ces séquences. *
+* dest = nouvelle(s) séquence(s) d'octets obtenue(s) [OUT] *
+* dcount = quantité de ces séquences. *
+* *
+* Description : Transforme une séquence d'octets pour motif de recherche. *
+* *
+* Retour : Bilan de l'opération : succès ou échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_enigma_murmur_modifier_transform(const GScanEnigmaMurmurModifier *modifier, const sized_binary_t *src, size_t scount, sized_binary_t **dest, size_t *dcount)
+{
+ bool result; /* Bilan d'opération à renvoyer*/
+ sized_binary_t *binary; /* Raccourci vers le stockage */
+ size_t i; /* Boucle de parcours #1 */
+ const sized_binary_t *_src; /* Source courante */
+ uint32_t hash; /* Valeur d'empreinte calculée */
+
+ result = true;
+
+ *dcount = scount;
+ *dest = calloc(*dcount, sizeof(sized_binary_t));
+
+ binary = &(*dest)[0];
+
+ for (i = 0; i < scount; i++, binary++)
+ {
+ _src = src + i;
+
+ hash = compute_enigma_murmur_hash32(_src);
+
+ binary->data = malloc(sizeof(hash) * sizeof(bin_t));
+ binary->len = sizeof(hash);
+
+ memcpy(binary->data, &hash, sizeof(hash));
+
+ }
+
+ 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_enigma_murmur_modifier_get_path(const GScanEnigmaMurmurModifier *modifier, size_t *index)
+{
+ char *result; /* Combinaison à retourner */
+
+ if (*index > 0)
+ {
+ result = NULL;
+ (*index)--;
+ }
+
+ else
+ result = strdup("enigma-murmur");
+
+ return result;
+
+}
diff --git a/plugins/apihashing/custom/enigma-murmur.h b/plugins/apihashing/custom/enigma-murmur.h
new file mode 100644
index 0000000..29ae803
--- /dev/null
+++ b/plugins/apihashing/custom/enigma-murmur.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * enigma-murmur.h - prototypes pour la transormation en empreinte d'API enigma-murmur
+ *
+ * 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 _PLUGINS_APIHASHING_CUSTOM_ENIGMA_MURMUR_H
+#define _PLUGINS_APIHASHING_CUSTOM_ENIGMA_MURMUR_H
+
+
+#include <glib-object.h>
+
+
+#include "../apihash.h"
+
+
+
+#define G_TYPE_SCAN_ENIGMA_MURMUR_MODIFIER g_scan_enigma_murmur_modifier_get_type()
+#define G_SCAN_ENIGMA_MURMUR_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_ENIGMA_MURMUR_MODIFIER, GScanEnigmaMurmurModifier))
+#define G_IS_SCAN_ENIGMA_MURMUR_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_ENIGMA_MURMUR_MODIFIER))
+#define G_SCAN_ENIGMA_MURMUR_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_ENIGMA_MURMUR_MODIFIER, GScanEnigmaMurmurModifierClass))
+#define G_IS_SCAN_ENIGMA_MURMUR_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_ENIGMA_MURMUR_MODIFIER))
+#define G_SCAN_ENIGMA_MURMUR_MODIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_ENIGMA_MURMUR_MODIFIER, GScanEnigmaMurmurModifierClass))
+
+
+/* Transormation en empreinte d'API enigma-murmur (instance) */
+typedef GApiHashModifier GScanEnigmaMurmurModifier;
+
+/* Transormation en empreinte d'API enigma-murmur (classe) */
+typedef GApiHashModifierClass GScanEnigmaMurmurModifierClass;
+
+
+/* Indique le type défini pour une transormation en empreinte enigma-murmur. */
+GType g_scan_enigma_murmur_modifier_get_type(void);
+
+/* Construit un modificateur pour des empreintes enigma-murmur. */
+GScanTokenModifier *g_scan_enigma_murmur_modifier_new(void);
+
+
+
+#endif /* _PLUGINS_APIHASHING_CUSTOM_ENIGMA_MURMUR_H */
diff --git a/plugins/apihashing/custom/imul21-add.c b/plugins/apihashing/custom/imul21-add.c
new file mode 100644
index 0000000..2f71910
--- /dev/null
+++ b/plugins/apihashing/custom/imul21-add.c
@@ -0,0 +1,326 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * imul21-add.c - transormation en empreinte d'API imul21-add
+ *
+ * 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 "imul21-add.h"
+
+
+#include <malloc.h>
+#include <string.h>
+
+
+#include <analysis/scan/patterns/modifier-int.h>
+
+
+
+
+/* ----------------------- RECHERCHE D'UN MOTIF DE TEXTE BRUT ----------------------- */
+
+
+/* Initialise la classe des transmissions en imul21-add. */
+static void g_scan_imul21_add_modifier_class_init(GScanImul21AddModifierClass *);
+
+/* Initialise une instance de transmission en imul21-add. */
+static void g_scan_imul21_add_modifier_init(GScanImul21AddModifier *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_imul21_add_modifier_dispose(GScanImul21AddModifier *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_imul21_add_modifier_finalize(GScanImul21AddModifier *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Fournit le nom d'appel d'un modificateur pour motif. */
+static char *g_scan_imul21_add_modifier_get_name(const GScanImul21AddModifier *);
+
+/* Calcule l'empreinte imul21-add d'un motif de recherche. */
+static uint32_t compute_imul21_add(const sized_binary_t *);
+
+/* Transforme une séquence d'octets pour motif de recherche. */
+static bool g_scan_imul21_add_modifier_transform(const GScanImul21AddModifier *, 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_imul21_add_modifier_get_path(const GScanImul21AddModifier *, size_t *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* RECHERCHE D'UN MOTIF DE TEXTE BRUT */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une transormation en empreinte imul21-add. */
+G_DEFINE_TYPE(GScanImul21AddModifier, g_scan_imul21_add_modifier, G_TYPE_API_HASH_MODIFIER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des transmissions en imul21-add. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_imul21_add_modifier_class_init(GScanImul21AddModifierClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanTokenModifierClass *modifier; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_imul21_add_modifier_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_imul21_add_modifier_finalize;
+
+ modifier = G_SCAN_TOKEN_MODIFIER_CLASS(klass);
+
+ modifier->get_name = (get_scan_modifier_name_fc)g_scan_imul21_add_modifier_get_name;
+
+ modifier->transform = (transform_scan_token_fc)g_scan_imul21_add_modifier_transform;
+ modifier->get_path = (get_modifier_path)g_scan_imul21_add_modifier_get_path;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance à initialiser. *
+* *
+* Description : Initialise une instance de transmission en imul21-add. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_imul21_add_modifier_init(GScanImul21AddModifier *modifier)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_imul21_add_modifier_dispose(GScanImul21AddModifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_imul21_add_modifier_parent_class)->dispose(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_imul21_add_modifier_finalize(GScanImul21AddModifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_imul21_add_modifier_parent_class)->finalize(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit un modificateur vers empreintes imul21-add. *
+* *
+* Retour : Mécanisme mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanTokenModifier *g_scan_imul21_add_modifier_new(void)
+{
+ GScanTokenModifier *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_IMUL21_ADD_MODIFIER, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à consulter. *
+* *
+* Description : Fournit le nom d'appel d'un modificateur pour motif. *
+* *
+* Retour : Désignation humaine. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_imul21_add_modifier_get_name(const GScanImul21AddModifier *modifier)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("imul21-add");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : src = séquence d'octets à traiter. *
+* *
+* Description : Calcule l'empreinte imul21-add d'un motif de recherche. *
+* *
+* Retour : Valeur entière de l'empreinte déterminée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static uint32_t compute_imul21_add(const sized_binary_t *src)
+{
+ uint32_t result; /* Valeur à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = 0;
+
+ for (i = 0; i < src->len; i++)
+ {
+ result *= 0x21;
+ result += src->data[i];
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à solliciter. *
+* src = séquences d'octets à traiter. *
+* scount = quantité de ces séquences. *
+* dest = nouvelle(s) séquence(s) d'octets obtenue(s) [OUT] *
+* dcount = quantité de ces séquences. *
+* *
+* Description : Transforme une séquence d'octets pour motif de recherche. *
+* *
+* Retour : Bilan de l'opération : succès ou échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_imul21_add_modifier_transform(const GScanImul21AddModifier *modifier, const sized_binary_t *src, size_t scount, sized_binary_t **dest, size_t *dcount)
+{
+ bool result; /* Bilan d'opération à renvoyer*/
+ sized_binary_t *binary; /* Raccourci vers le stockage */
+ size_t i; /* Boucle de parcours #1 */
+ const sized_binary_t *_src; /* Source courante */
+ uint32_t hash; /* Valeur d'empreinte calculée */
+
+ result = true;
+
+ *dcount = scount;
+ *dest = calloc(*dcount, sizeof(sized_binary_t));
+
+ binary = &(*dest)[0];
+
+ for (i = 0; i < scount; i++, binary++)
+ {
+ _src = src + i;
+
+ hash = compute_imul21_add(_src);
+
+ binary->data = malloc(sizeof(hash) * sizeof(bin_t));
+ binary->len = sizeof(hash);
+
+ memcpy(binary->data, &hash, sizeof(hash));
+
+ }
+
+ 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_imul21_add_modifier_get_path(const GScanImul21AddModifier *modifier, size_t *index)
+{
+ char *result; /* Combinaison à retourner */
+
+ if (*index > 0)
+ {
+ result = NULL;
+ (*index)--;
+ }
+
+ else
+ result = strdup("imul21-add");
+
+ return result;
+
+}
diff --git a/plugins/apihashing/custom/imul21-add.h b/plugins/apihashing/custom/imul21-add.h
new file mode 100644
index 0000000..fcaa140
--- /dev/null
+++ b/plugins/apihashing/custom/imul21-add.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * imul21-add.h - prototypes pour la transormation en empreinte d'API imul21-add
+ *
+ * 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 _PLUGINS_APIHASHING_CUSTOM_IMUL21_ADD_H
+#define _PLUGINS_APIHASHING_CUSTOM_IMUL21_ADD_H
+
+
+#include <glib-object.h>
+
+
+#include "../apihash.h"
+
+
+
+#define G_TYPE_SCAN_IMUL21_ADD_MODIFIER g_scan_imul21_add_modifier_get_type()
+#define G_SCAN_IMUL21_ADD_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_IMUL21_ADD_MODIFIER, GScanImul21AddModifier))
+#define G_IS_SCAN_IMUL21_ADD_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_IMUL21_ADD_MODIFIER))
+#define G_SCAN_IMUL21_ADD_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_IMUL21_ADD_MODIFIER, GScanImul21AddModifierClass))
+#define G_IS_SCAN_IMUL21_ADD_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_IMUL21_ADD_MODIFIER))
+#define G_SCAN_IMUL21_ADD_MODIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_IMUL21_ADD_MODIFIER, GScanImul21AddModifierClass))
+
+
+/* Transformation en empreinte d'API imul21-add (instance) */
+typedef GApiHashModifier GScanImul21AddModifier;
+
+/* Transformation en empreinte d'API imul21-add (classe) */
+typedef GApiHashModifierClass GScanImul21AddModifierClass;
+
+
+/* Indique le type défini pour une transormation en empreinte imul21-add. */
+GType g_scan_imul21_add_modifier_get_type(void);
+
+/* Construit un modificateur vers empreintes imul21-add. */
+GScanTokenModifier *g_scan_imul21_add_modifier_new(void);
+
+
+
+#endif /* _PLUGINS_APIHASHING_CUSTOM_IMUL21_ADD_H */
diff --git a/plugins/apihashing/custom/imul83-add.c b/plugins/apihashing/custom/imul83-add.c
new file mode 100644
index 0000000..29f8cf5
--- /dev/null
+++ b/plugins/apihashing/custom/imul83-add.c
@@ -0,0 +1,326 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * imul83-add.c - transormation en empreinte d'API imul83-add
+ *
+ * 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 "imul83-add.h"
+
+
+#include <malloc.h>
+#include <string.h>
+
+
+#include <analysis/scan/patterns/modifier-int.h>
+
+
+
+
+/* ----------------------- RECHERCHE D'UN MOTIF DE TEXTE BRUT ----------------------- */
+
+
+/* Initialise la classe des transmissions en imul83-add. */
+static void g_scan_imul83_add_modifier_class_init(GScanImul83AddModifierClass *);
+
+/* Initialise une instance de transmission en imul83-add. */
+static void g_scan_imul83_add_modifier_init(GScanImul83AddModifier *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_imul83_add_modifier_dispose(GScanImul83AddModifier *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_imul83_add_modifier_finalize(GScanImul83AddModifier *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Fournit le nom d'appel d'un modificateur pour motif. */
+static char *g_scan_imul83_add_modifier_get_name(const GScanImul83AddModifier *);
+
+/* Calcule l'empreinte imul83-add d'un motif de recherche. */
+static uint32_t compute_imul83_add(const sized_binary_t *);
+
+/* Transforme une séquence d'octets pour motif de recherche. */
+static bool g_scan_imul83_add_modifier_transform(const GScanImul83AddModifier *, 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_imul83_add_modifier_get_path(const GScanImul83AddModifier *, size_t *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* RECHERCHE D'UN MOTIF DE TEXTE BRUT */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une transormation en empreinte imul83-add. */
+G_DEFINE_TYPE(GScanImul83AddModifier, g_scan_imul83_add_modifier, G_TYPE_API_HASH_MODIFIER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des transmissions en imul83-add. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_imul83_add_modifier_class_init(GScanImul83AddModifierClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanTokenModifierClass *modifier; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_imul83_add_modifier_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_imul83_add_modifier_finalize;
+
+ modifier = G_SCAN_TOKEN_MODIFIER_CLASS(klass);
+
+ modifier->get_name = (get_scan_modifier_name_fc)g_scan_imul83_add_modifier_get_name;
+
+ modifier->transform = (transform_scan_token_fc)g_scan_imul83_add_modifier_transform;
+ modifier->get_path = (get_modifier_path)g_scan_imul83_add_modifier_get_path;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance à initialiser. *
+* *
+* Description : Initialise une instance de transmission en imul83-add. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_imul83_add_modifier_init(GScanImul83AddModifier *modifier)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_imul83_add_modifier_dispose(GScanImul83AddModifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_imul83_add_modifier_parent_class)->dispose(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_imul83_add_modifier_finalize(GScanImul83AddModifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_imul83_add_modifier_parent_class)->finalize(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit un modificateur vers empreintes imul83-add. *
+* *
+* Retour : Mécanisme mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanTokenModifier *g_scan_imul83_add_modifier_new(void)
+{
+ GScanTokenModifier *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_IMUL83_ADD_MODIFIER, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à consulter. *
+* *
+* Description : Fournit le nom d'appel d'un modificateur pour motif. *
+* *
+* Retour : Désignation humaine. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_imul83_add_modifier_get_name(const GScanImul83AddModifier *modifier)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("imul83-add");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : src = séquence d'octets à traiter. *
+* *
+* Description : Calcule l'empreinte imul83-add d'un motif de recherche. *
+* *
+* Retour : Valeur entière de l'empreinte déterminée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static uint32_t compute_imul83_add(const sized_binary_t *src)
+{
+ uint32_t result; /* Valeur à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = 0;
+
+ for (i = 0; i < src->len; i++)
+ {
+ result *= 0x83;
+ result += src->data[i];
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à solliciter. *
+* src = séquences d'octets à traiter. *
+* scount = quantité de ces séquences. *
+* dest = nouvelle(s) séquence(s) d'octets obtenue(s) [OUT] *
+* dcount = quantité de ces séquences. *
+* *
+* Description : Transforme une séquence d'octets pour motif de recherche. *
+* *
+* Retour : Bilan de l'opération : succès ou échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_imul83_add_modifier_transform(const GScanImul83AddModifier *modifier, const sized_binary_t *src, size_t scount, sized_binary_t **dest, size_t *dcount)
+{
+ bool result; /* Bilan d'opération à renvoyer*/
+ sized_binary_t *binary; /* Raccourci vers le stockage */
+ size_t i; /* Boucle de parcours #1 */
+ const sized_binary_t *_src; /* Source courante */
+ uint32_t hash; /* Valeur d'empreinte calculée */
+
+ result = true;
+
+ *dcount = scount;
+ *dest = calloc(*dcount, sizeof(sized_binary_t));
+
+ binary = &(*dest)[0];
+
+ for (i = 0; i < scount; i++, binary++)
+ {
+ _src = src + i;
+
+ hash = compute_imul83_add(_src);
+
+ binary->data = malloc(sizeof(hash) * sizeof(bin_t));
+ binary->len = sizeof(hash);
+
+ memcpy(binary->data, &hash, sizeof(hash));
+
+ }
+
+ 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_imul83_add_modifier_get_path(const GScanImul83AddModifier *modifier, size_t *index)
+{
+ char *result; /* Combinaison à retourner */
+
+ if (*index > 0)
+ {
+ result = NULL;
+ (*index)--;
+ }
+
+ else
+ result = strdup("imul83-add");
+
+ return result;
+
+}
diff --git a/plugins/apihashing/custom/imul83-add.h b/plugins/apihashing/custom/imul83-add.h
new file mode 100644
index 0000000..7e376ee
--- /dev/null
+++ b/plugins/apihashing/custom/imul83-add.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * imul83-add.h - prototypes pour la transormation en empreinte d'API imul83-add
+ *
+ * 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 _PLUGINS_APIHASHING_CUSTOM_IMUL83_ADD_H
+#define _PLUGINS_APIHASHING_CUSTOM_IMUL83_ADD_H
+
+
+#include <glib-object.h>
+
+
+#include "../apihash.h"
+
+
+
+#define G_TYPE_SCAN_IMUL83_ADD_MODIFIER g_scan_imul83_add_modifier_get_type()
+#define G_SCAN_IMUL83_ADD_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_IMUL83_ADD_MODIFIER, GScanImul83AddModifier))
+#define G_IS_SCAN_IMUL83_ADD_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_IMUL83_ADD_MODIFIER))
+#define G_SCAN_IMUL83_ADD_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_IMUL83_ADD_MODIFIER, GScanImul83AddModifierClass))
+#define G_IS_SCAN_IMUL83_ADD_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_IMUL83_ADD_MODIFIER))
+#define G_SCAN_IMUL83_ADD_MODIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_IMUL83_ADD_MODIFIER, GScanImul83AddModifierClass))
+
+
+/* Transformation en empreinte d'API imul83-add (instance) */
+typedef GApiHashModifier GScanImul83AddModifier;
+
+/* Transformation en empreinte d'API imul83-add (classe) */
+typedef GApiHashModifierClass GScanImul83AddModifierClass;
+
+
+/* Indique le type défini pour une transormation en empreinte imul83-add. */
+GType g_scan_imul83_add_modifier_get_type(void);
+
+/* Construit un modificateur vers empreintes imul83-add. */
+GScanTokenModifier *g_scan_imul83_add_modifier_new(void);
+
+
+
+#endif /* _PLUGINS_APIHASHING_CUSTOM_IMUL83_ADD_H */
diff --git a/plugins/apihashing/custom/sll1-add-hash32.c b/plugins/apihashing/custom/sll1-add-hash32.c
new file mode 100644
index 0000000..de00f81
--- /dev/null
+++ b/plugins/apihashing/custom/sll1-add-hash32.c
@@ -0,0 +1,326 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * sll1-add-hash32.c - transormation en empreinte d'API sll1-add-hash32
+ *
+ * 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 "sll1-add-hash32.h"
+
+
+#include <malloc.h>
+#include <string.h>
+
+
+#include <analysis/scan/patterns/modifier-int.h>
+
+
+
+
+/* ----------------------- RECHERCHE D'UN MOTIF DE TEXTE BRUT ----------------------- */
+
+
+/* Initialise la classe des transmissions en sll1-add-hash32. */
+static void g_scan_sll1_add_hash32_modifier_class_init(GScanSll1AddHash32ModifierClass *klass);
+
+/* Initialise une instance de transmission en sll1-add-hash32. */
+static void g_scan_sll1_add_hash32_modifier_init(GScanSll1AddHash32Modifier *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_sll1_add_hash32_modifier_dispose(GScanSll1AddHash32Modifier *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_sll1_add_hash32_modifier_finalize(GScanSll1AddHash32Modifier *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Fournit le nom d'appel d'un modificateur pour motif. */
+static char *g_scan_sll1_add_hash32_modifier_get_name(const GScanSll1AddHash32Modifier *);
+
+/* Calcule l'empreinte sll1-add-hash32 d'un motif de recherche. */
+static uint32_t compute_sll1_add_hash32(const sized_binary_t *);
+
+/* Transforme une séquence d'octets pour motif de recherche. */
+static bool g_scan_sll1_add_hash32_modifier_transform(const GScanSll1AddHash32Modifier *, 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_sll1_add_hash32_modifier_get_path(const GScanSll1AddHash32Modifier *, size_t *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* RECHERCHE D'UN MOTIF DE TEXTE BRUT */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une transormation en empreinte sll1-add-hash32. */
+G_DEFINE_TYPE(GScanSll1AddHash32Modifier, g_scan_sll1_add_hash32_modifier, G_TYPE_API_HASH_MODIFIER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des transmissions en sll1-add-hash32. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sll1_add_hash32_modifier_class_init(GScanSll1AddHash32ModifierClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanTokenModifierClass *modifier; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_sll1_add_hash32_modifier_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_sll1_add_hash32_modifier_finalize;
+
+ modifier = G_SCAN_TOKEN_MODIFIER_CLASS(klass);
+
+ modifier->get_name = (get_scan_modifier_name_fc)g_scan_sll1_add_hash32_modifier_get_name;
+
+ modifier->transform = (transform_scan_token_fc)g_scan_sll1_add_hash32_modifier_transform;
+ modifier->get_path = (get_modifier_path)g_scan_sll1_add_hash32_modifier_get_path;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance à initialiser. *
+* *
+* Description : Initialise une instance de transmission en sll1-add-hash32. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sll1_add_hash32_modifier_init(GScanSll1AddHash32Modifier *modifier)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sll1_add_hash32_modifier_dispose(GScanSll1AddHash32Modifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_sll1_add_hash32_modifier_parent_class)->dispose(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sll1_add_hash32_modifier_finalize(GScanSll1AddHash32Modifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_sll1_add_hash32_modifier_parent_class)->finalize(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit un modificateur vers empreintes sll1-add-hash32. *
+* *
+* Retour : Mécanisme mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanTokenModifier *g_scan_sll1_add_hash32_modifier_new(void)
+{
+ GScanTokenModifier *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_SLL1_ADD_HASH32_MODIFIER, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à consulter. *
+* *
+* Description : Fournit le nom d'appel d'un modificateur pour motif. *
+* *
+* Retour : Désignation humaine. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_sll1_add_hash32_modifier_get_name(const GScanSll1AddHash32Modifier *modifier)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("sll1-add-hash32");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : src = séquence d'octets à traiter. *
+* *
+* Description : Calcule l'empreinte sll1-add-hash32 d'un motif de recherche. *
+* *
+* Retour : Valeur entière de l'empreinte déterminée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static uint32_t compute_sll1_add_hash32(const sized_binary_t *src)
+{
+ uint32_t result; /* Valeur à retourner */
+ size_t i; /* Boucle de parcours */
+
+ result = 0;
+
+ for (i = 0; i < src->len; i++)
+ {
+ result += (src->data[i] | 0x60);
+ result <<= 1;
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à solliciter. *
+* src = séquences d'octets à traiter. *
+* scount = quantité de ces séquences. *
+* dest = nouvelle(s) séquence(s) d'octets obtenue(s) [OUT] *
+* dcount = quantité de ces séquences. *
+* *
+* Description : Transforme une séquence d'octets pour motif de recherche. *
+* *
+* Retour : Bilan de l'opération : succès ou échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_sll1_add_hash32_modifier_transform(const GScanSll1AddHash32Modifier *modifier, const sized_binary_t *src, size_t scount, sized_binary_t **dest, size_t *dcount)
+{
+ bool result; /* Bilan d'opération à renvoyer*/
+ sized_binary_t *binary; /* Raccourci vers le stockage */
+ size_t i; /* Boucle de parcours #1 */
+ const sized_binary_t *_src; /* Source courante */
+ uint32_t hash; /* Valeur d'empreinte calculée */
+
+ result = true;
+
+ *dcount = scount;
+ *dest = calloc(*dcount, sizeof(sized_binary_t));
+
+ binary = &(*dest)[0];
+
+ for (i = 0; i < scount; i++, binary++)
+ {
+ _src = src + i;
+
+ hash = compute_sll1_add_hash32(_src);
+
+ binary->data = malloc(sizeof(hash) * sizeof(bin_t));
+ binary->len = sizeof(hash);
+
+ memcpy(binary->data, &hash, sizeof(hash));
+
+ }
+
+ 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_sll1_add_hash32_modifier_get_path(const GScanSll1AddHash32Modifier *modifier, size_t *index)
+{
+ char *result; /* Combinaison à retourner */
+
+ if (*index > 0)
+ {
+ result = NULL;
+ (*index)--;
+ }
+
+ else
+ result = strdup("sll1-add-hash32");
+
+ return result;
+
+}
diff --git a/plugins/apihashing/custom/sll1-add-hash32.h b/plugins/apihashing/custom/sll1-add-hash32.h
new file mode 100644
index 0000000..39abee2
--- /dev/null
+++ b/plugins/apihashing/custom/sll1-add-hash32.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * sll1-add-hash32.h - prototypes pour la transormation en empreinte d'API sll1-add-hash32
+ *
+ * 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 _PLUGINS_APIHASHING_CUSTOM_SLL1_ADD_HASH32_H
+#define _PLUGINS_APIHASHING_CUSTOM_SLL1_ADD_HASH32_H
+
+
+#include <glib-object.h>
+
+
+#include "../apihash.h"
+
+
+
+#define G_TYPE_SCAN_SLL1_ADD_HASH32_MODIFIER g_scan_sll1_add_hash32_modifier_get_type()
+#define G_SCAN_SLL1_ADD_HASH32_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_SLL1_ADD_HASH32_MODIFIER, GScanSll1AddHash32Modifier))
+#define G_IS_SCAN_SLL1_ADD_HASH32_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_SLL1_ADD_HASH32_MODIFIER))
+#define G_SCAN_SLL1_ADD_HASH32_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_SLL1_ADD_HASH32_MODIFIER, GScanSll1AddHash32ModifierClass))
+#define G_IS_SCAN_SLL1_ADD_HASH32_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_SLL1_ADD_HASH32_MODIFIER))
+#define G_SCAN_SLL1_ADD_HASH32_MODIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_SLL1_ADD_HASH32_MODIFIER, GScanSll1AddHash32ModifierClass))
+
+
+/* Transormation en empreinte d'API sll1_add_hash32 (instance) */
+typedef GApiHashModifier GScanSll1AddHash32Modifier;
+
+/* Transormation en empreinte d'API sll1_add_hash32 (classe) */
+typedef GApiHashModifierClass GScanSll1AddHash32ModifierClass;
+
+
+/* Indique le type défini pour une transormation en empreinte sll1-add-hash32. */
+GType g_scan_sll1_add_hash32_modifier_get_type(void);
+
+/* Construit un modificateur vers empreintes sll1-add-hash32. */
+GScanTokenModifier *g_scan_sll1_add_hash32_modifier_new(void);
+
+
+
+#endif /* _PLUGINS_APIHASHING_CUSTOM_SLL1_ADD_HASH32_H */
diff --git a/plugins/apihashing/custom/sub-index1.c b/plugins/apihashing/custom/sub-index1.c
new file mode 100644
index 0000000..79eafd8
--- /dev/null
+++ b/plugins/apihashing/custom/sub-index1.c
@@ -0,0 +1,291 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * sub-index1.c - transormation en empreinte d'API sub-index1
+ *
+ * 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 "sub-index1.h"
+
+
+#include <malloc.h>
+
+
+#include <analysis/scan/patterns/modifier-int.h>
+
+
+
+
+/* ----------------------- RECHERCHE D'UN MOTIF DE TEXTE BRUT ----------------------- */
+
+
+/* Initialise la classe des transmissions en sub-index1. */
+static void g_scan_sub_index1_modifier_class_init(GScanSubIndex1ModifierClass *);
+
+/* Initialise une instance de transmission en sub-index1. */
+static void g_scan_sub_index1_modifier_init(GScanSubIndex1Modifier *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_sub_index1_modifier_dispose(GScanSubIndex1Modifier *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_sub_index1_modifier_finalize(GScanSubIndex1Modifier *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Fournit le nom d'appel d'un modificateur pour motif. */
+static char *g_scan_sub_index1_modifier_get_name(const GScanSubIndex1Modifier *);
+
+/* Transforme une séquence d'octets pour motif de recherche. */
+static bool g_scan_sub_index1_modifier_transform(const GScanSubIndex1Modifier *, 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_sub_index1_modifier_get_path(const GScanSubIndex1Modifier *, size_t *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* RECHERCHE D'UN MOTIF DE TEXTE BRUT */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une transormation en empreinte sub-index1. */
+G_DEFINE_TYPE(GScanSubIndex1Modifier, g_scan_sub_index1_modifier, G_TYPE_API_HASH_MODIFIER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des transmissions en sub-index1. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sub_index1_modifier_class_init(GScanSubIndex1ModifierClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanTokenModifierClass *modifier; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_sub_index1_modifier_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_sub_index1_modifier_finalize;
+
+ modifier = G_SCAN_TOKEN_MODIFIER_CLASS(klass);
+
+ modifier->get_name = (get_scan_modifier_name_fc)g_scan_sub_index1_modifier_get_name;
+
+ modifier->transform = (transform_scan_token_fc)g_scan_sub_index1_modifier_transform;
+ modifier->get_path = (get_modifier_path)g_scan_sub_index1_modifier_get_path;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance à initialiser. *
+* *
+* Description : Initialise une instance de transmission en sub-index1. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sub_index1_modifier_init(GScanSubIndex1Modifier *modifier)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sub_index1_modifier_dispose(GScanSubIndex1Modifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_sub_index1_modifier_parent_class)->dispose(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sub_index1_modifier_finalize(GScanSubIndex1Modifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_sub_index1_modifier_parent_class)->finalize(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit un modificateur livrant des empreintes sub-index1. *
+* *
+* Retour : Mécanisme mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanTokenModifier *g_scan_sub_index1_modifier_new(void)
+{
+ GScanTokenModifier *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_SUB_INDEX1_MODIFIER, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à consulter. *
+* *
+* Description : Fournit le nom d'appel d'un modificateur pour motif. *
+* *
+* Retour : Désignation humaine. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_sub_index1_modifier_get_name(const GScanSubIndex1Modifier *modifier)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("sub-index1");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à solliciter. *
+* src = séquences d'octets à traiter. *
+* scount = quantité de ces séquences. *
+* dest = nouvelle(s) séquence(s) d'octets obtenue(s) [OUT] *
+* dcount = quantité de ces séquences. *
+* *
+* Description : Transforme une séquence d'octets pour motif de recherche. *
+* *
+* Retour : Bilan de l'opération : succès ou échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_sub_index1_modifier_transform(const GScanSubIndex1Modifier *modifier, const sized_binary_t *src, size_t scount, sized_binary_t **dest, size_t *dcount)
+{
+ bool result; /* Bilan d'opération à renvoyer*/
+ sized_binary_t *binary; /* Raccourci vers le stockage */
+ size_t i; /* Boucle de parcours #1 */
+ const sized_binary_t *_src; /* Source courante */
+ size_t k; /* Boucle de parcours #2 */
+
+ result = true;
+
+ *dcount = scount;
+ *dest = calloc(*dcount, sizeof(sized_binary_t));
+
+ binary = &(*dest)[0];
+
+ for (i = 0; i < scount; i++, binary++)
+ {
+ _src = src + i;
+
+ binary->len = _src->len;
+ binary->data = malloc(binary->len);
+
+ for (k = 0; k < _src->len; k++)
+ binary->data[k] = _src->data[k] + k + 1;
+
+ }
+
+ 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_sub_index1_modifier_get_path(const GScanSubIndex1Modifier *modifier, size_t *index)
+{
+ char *result; /* Combinaison à retourner */
+
+ if (*index > 0)
+ {
+ result = NULL;
+ (*index)--;
+ }
+
+ else
+ result = strdup("sub-index1");
+
+ return result;
+
+}
diff --git a/plugins/apihashing/custom/sub-index1.h b/plugins/apihashing/custom/sub-index1.h
new file mode 100644
index 0000000..b2acc06
--- /dev/null
+++ b/plugins/apihashing/custom/sub-index1.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * sub-index1.h - prototypes pour la transormation en empreinte d'API sub-index1
+ *
+ * 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 _PLUGINS_APIHASHING_CUSTOM_SUB_INDEX1_H
+#define _PLUGINS_APIHASHING_CUSTOM_SUB_INDEX1_H
+
+
+#include <glib-object.h>
+
+
+#include "../apihash.h"
+
+
+
+#define G_TYPE_SCAN_SUB_INDEX1_MODIFIER g_scan_sub_index1_modifier_get_type()
+#define G_SCAN_SUB_INDEX1_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_SUB_INDEX1_MODIFIER, GScanSubIndex1Modifier))
+#define G_IS_SCAN_SUB_INDEX1_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_SUB_INDEX1_MODIFIER))
+#define G_SCAN_SUB_INDEX1_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_SUB_INDEX1_MODIFIER, GScanSubIndex1ModifierClass))
+#define G_IS_SCAN_SUB_INDEX1_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_SUB_INDEX1_MODIFIER))
+#define G_SCAN_SUB_INDEX1_MODIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_SUB_INDEX1_MODIFIER, GScanSubIndex1ModifierClass))
+
+
+/* Transormation en empreinte d'API sub-index1 (instance) */
+typedef GApiHashModifier GScanSubIndex1Modifier;
+
+/* Transormation en empreinte d'API sub-index1 (classe) */
+typedef GApiHashModifierClass GScanSubIndex1ModifierClass;
+
+
+/* Indique le type défini pour une transormation en empreinte sub-index1. */
+GType g_scan_sub_index1_modifier_get_type(void);
+
+/* Construit un modificateur livrant des empreintes sub-index1. */
+GScanTokenModifier *g_scan_sub_index1_modifier_new(void);
+
+
+
+#endif /* _PLUGINS_APIHASHING_CUSTOM_SUB_INDEX1_H */
diff --git a/plugins/apihashing/custom/sub42.c b/plugins/apihashing/custom/sub42.c
new file mode 100644
index 0000000..95bd49d
--- /dev/null
+++ b/plugins/apihashing/custom/sub42.c
@@ -0,0 +1,291 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * sub42.c - transormation en empreinte d'API sub42
+ *
+ * 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 "sub42.h"
+
+
+#include <malloc.h>
+
+
+#include <analysis/scan/patterns/modifier-int.h>
+
+
+
+
+/* ----------------------- RECHERCHE D'UN MOTIF DE TEXTE BRUT ----------------------- */
+
+
+/* Initialise la classe des transmissions en empreintes sub42. */
+static void g_scan_sub42_modifier_class_init(GScanSub42ModifierClass *);
+
+/* Initialise une instance de transmission en empreinte sub42. */
+static void g_scan_sub42_modifier_init(GScanSub42Modifier *);
+
+/* Supprime toutes les références externes. */
+static void g_scan_sub42_modifier_dispose(GScanSub42Modifier *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_scan_sub42_modifier_finalize(GScanSub42Modifier *);
+
+
+
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Fournit le nom d'appel d'un modificateur pour motif. */
+static char *g_scan_sub42_modifier_get_name(const GScanSub42Modifier *);
+
+/* Transforme une séquence d'octets pour motif de recherche. */
+static bool g_scan_sub42_modifier_transform(const GScanSub42Modifier *, 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_sub42_modifier_get_path(const GScanSub42Modifier *, size_t *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* RECHERCHE D'UN MOTIF DE TEXTE BRUT */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une transormation en empreinte sub42. */
+G_DEFINE_TYPE(GScanSub42Modifier, g_scan_sub42_modifier, G_TYPE_API_HASH_MODIFIER);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des transmissions en empreintes sub42. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sub42_modifier_class_init(GScanSub42ModifierClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+ GScanTokenModifierClass *modifier; /* Version de classe parente */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_scan_sub42_modifier_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_scan_sub42_modifier_finalize;
+
+ modifier = G_SCAN_TOKEN_MODIFIER_CLASS(klass);
+
+ modifier->get_name = (get_scan_modifier_name_fc)g_scan_sub42_modifier_get_name;
+
+ modifier->transform = (transform_scan_token_fc)g_scan_sub42_modifier_transform;
+ modifier->get_path = (get_modifier_path)g_scan_sub42_modifier_get_path;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance à initialiser. *
+* *
+* Description : Initialise une instance de transmission en empreinte sub42. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sub42_modifier_init(GScanSub42Modifier *modifier)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sub42_modifier_dispose(GScanSub42Modifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_sub42_modifier_parent_class)->dispose(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_scan_sub42_modifier_finalize(GScanSub42Modifier *modifier)
+{
+ G_OBJECT_CLASS(g_scan_sub42_modifier_parent_class)->finalize(G_OBJECT(modifier));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit un modificateur livrant des empreintes sub42. *
+* *
+* Retour : Mécanisme mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GScanTokenModifier *g_scan_sub42_modifier_new(void)
+{
+ GScanTokenModifier *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SCAN_SUB42_MODIFIER, NULL);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à consulter. *
+* *
+* Description : Fournit le nom d'appel d'un modificateur pour motif. *
+* *
+* Retour : Désignation humaine. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *g_scan_sub42_modifier_get_name(const GScanSub42Modifier *modifier)
+{
+ char *result; /* Désignation à retourner */
+
+ result = strdup("sub42");
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : modifier = modificateur à solliciter. *
+* src = séquences d'octets à traiter. *
+* scount = quantité de ces séquences. *
+* dest = nouvelle(s) séquence(s) d'octets obtenue(s) [OUT] *
+* dcount = quantité de ces séquences. *
+* *
+* Description : Transforme une séquence d'octets pour motif de recherche. *
+* *
+* Retour : Bilan de l'opération : succès ou échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_scan_sub42_modifier_transform(const GScanSub42Modifier *modifier, const sized_binary_t *src, size_t scount, sized_binary_t **dest, size_t *dcount)
+{
+ bool result; /* Bilan d'opération à renvoyer*/
+ sized_binary_t *binary; /* Raccourci vers le stockage */
+ size_t i; /* Boucle de parcours #1 */
+ const sized_binary_t *_src; /* Source courante */
+ size_t k; /* Boucle de parcours #2 */
+
+ result = true;
+
+ *dcount = scount;
+ *dest = calloc(*dcount, sizeof(sized_binary_t));
+
+ binary = &(*dest)[0];
+
+ for (i = 0; i < scount; i++, binary++)
+ {
+ _src = src + i;
+
+ binary->len = _src->len;
+ binary->data = malloc(binary->len);
+
+ for (k = 0; k < _src->len; k++)
+ binary->data[k] = _src->data[k] + 0x42;
+
+ }
+
+ 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_sub42_modifier_get_path(const GScanSub42Modifier *modifier, size_t *index)
+{
+ char *result; /* Combinaison à retourner */
+
+ if (*index > 0)
+ {
+ result = NULL;
+ (*index)--;
+ }
+
+ else
+ result = strdup("sub42");
+
+ return result;
+
+}
diff --git a/plugins/apihashing/custom/sub42.h b/plugins/apihashing/custom/sub42.h
new file mode 100644
index 0000000..8a11741
--- /dev/null
+++ b/plugins/apihashing/custom/sub42.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * sub42.h - prototypes pour la transormation en empreinte d'API sub42
+ *
+ * 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 _PLUGINS_APIHASHING_CUSTOM_SUB42_H
+#define _PLUGINS_APIHASHING_CUSTOM_SUB42_H
+
+
+#include <glib-object.h>
+
+
+#include "../apihash.h"
+
+
+
+#define G_TYPE_SCAN_SUB42_MODIFIER g_scan_sub42_modifier_get_type()
+#define G_SCAN_SUB42_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_SCAN_SUB42_MODIFIER, GScanSub42Modifier))
+#define G_IS_SCAN_SUB42_MODIFIER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_SCAN_SUB42_MODIFIER))
+#define G_SCAN_SUB42_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SCAN_SUB42_MODIFIER, GScanSub42ModifierClass))
+#define G_IS_SCAN_SUB42_MODIFIER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SCAN_SUB42_MODIFIER))
+#define G_SCAN_SUB42_MODIFIER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SCAN_SUB42_MODIFIER, GScanSub42ModifierClass))
+
+
+/* Transormation en empreinte d'API sub42 (instance) */
+typedef GApiHashModifier GScanSub42Modifier;
+
+/* Transormation en empreinte d'API sub42 (classe) */
+typedef GApiHashModifierClass GScanSub42ModifierClass;
+
+
+/* Indique le type défini pour une transormation en empreinte sub42. */
+GType g_scan_sub42_modifier_get_type(void);
+
+/* Construit un modificateur livrant des empreintes sub42. */
+GScanTokenModifier *g_scan_sub42_modifier_new(void);
+
+
+
+#endif /* _PLUGINS_APIHASHING_CUSTOM_SUB42_H */