summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-05-17 00:28:23 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-05-17 00:28:23 (GMT)
commit7adb4243ad629554e496de173977721a8a5d0110 (patch)
tree18f50fcdab35e057b3a1a10e7e0c1f141e89eb39 /plugins
parent118a668adbf6ca9d4c549618e54f58330f46ce58 (diff)
Given more details for each operand relative to one DEX pool.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@156 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am2
-rw-r--r--plugins/dexresolver/Makefile.am16
-rw-r--r--plugins/dexresolver/context.c320
-rw-r--r--plugins/dexresolver/context.h57
-rw-r--r--plugins/dexresolver/operand.c306
-rw-r--r--plugins/dexresolver/operand.h70
-rw-r--r--plugins/dexresolver/plugin.c120
-rw-r--r--plugins/dexresolver/plugin.h49
8 files changed, 939 insertions, 1 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 63811b0..d3111b7 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = pyoida stackvars theseus
+SUBDIRS = dexresolver pyoida stackvars theseus
diff --git a/plugins/dexresolver/Makefile.am b/plugins/dexresolver/Makefile.am
new file mode 100644
index 0000000..f290a99
--- /dev/null
+++ b/plugins/dexresolver/Makefile.am
@@ -0,0 +1,16 @@
+
+lib_LTLIBRARIES = libdexresolver.la
+
+libdexresolver_la_SOURCES = \
+ context.h context.c \
+ operand.h operand.c \
+ plugin.h plugin.c
+
+libdexresolver_la_CFLAGS = $(AM_CFLAGS)
+
+
+INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) -I../../src
+
+AM_CPPFLAGS =
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/dexresolver/context.c b/plugins/dexresolver/context.c
new file mode 100644
index 0000000..0b863e9
--- /dev/null
+++ b/plugins/dexresolver/context.c
@@ -0,0 +1,320 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * context.h - prototypes pour les instances d'actions du présent greffon
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "context.h"
+
+
+#include <analysis/line_code.h>
+#include <arch/dalvik/operand.h>
+#include <glibext/delayed-int.h>
+#include <plugins/context-int.h>
+
+
+#include "operand.h"
+
+
+
+/* ---------------------------- REMPLACEMENT D'OPERANDES ---------------------------- */
+
+
+#define G_TYPE_DEX_RESOLVER_WORK g_dex_resolver_work_get_type()
+#define G_DEX_RESOLVER_WORK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dex_resolver_work_get_type(), GDelayedDisassembly))
+#define G_IS_DEX_RESOLVER_WORK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dex_resolver_work_get_type()))
+#define G_DEX_RESOLVER_WORK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DEX_RESOLVER_WORK, GDelayedDisassemblyClass))
+#define G_IS_DEX_RESOLVER_WORK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DEX_RESOLVER_WORK))
+#define G_DEX_RESOLVER_WORK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DEX_RESOLVER_WORK, GDelayedDisassemblyClass))
+
+
+/* Instance du greffon pour OpenIDA (instance) */
+typedef struct _GDexResolverWork
+{
+ GDelayedWork parent; /* A laisser en premier */
+
+ GOpenidaBinary *binary; /* Destinataire final */
+
+} GDexResolverWork;
+
+
+/* Instance du greffon pour OpenIDA (classe) */
+typedef struct _GDexResolverWorkClass
+{
+ GDelayedWorkClass parent; /* A laisser en premier */
+
+} GDexResolverWorkClass;
+
+
+/* Indique le type défini pour les tâches de résolutions différées. */
+static GType g_dex_resolver_work_get_type(void);
+
+/* Initialise la classe des résolutions d'opérandes différées. */
+static void g_dex_resolver_work_class_init(GDexResolverWorkClass *);
+
+/* Initialise une tâche de résolution d'opérandes différée. */
+static void g_dex_resolver_work_init(GDexResolverWork *);
+
+/* Crée une tâche de résolution d'opérandes différée. */
+static GDexResolverWork *g_dex_resolver_work_new(GOpenidaBinary *);
+
+/* Assure la résolution d'opérandes en différé. */
+static void g_dex_resolver_work_process(GDexResolverWork *, GtkExtStatusBar *);
+
+
+
+/* -------------------------- TACHE DIFFEREE DANS LE TEMPS -------------------------- */
+/* -------------------------- TACHE DIFFEREE DANS LE TEMPS -------------------------- */
+
+
+
+/* Instance du greffon pour OpenIDA (instance) */
+struct _GDexResolverContext
+{
+ GPluginContext parent; /* A laisser en premier */
+
+};
+
+
+/* Instance du greffon pour OpenIDA (classe) */
+struct _GDexResolverContextClass
+{
+ GPluginContextClass parent; /* A laisser en premier */
+
+};
+
+
+
+/* Initialise la classe des instances de greffon. */
+static void g_dex_resolver_context_class_init(GDexResolverContextClass *);
+
+/* Initialise une instance d'instance de greffon. */
+static void g_dex_resolver_context_init(GDexResolverContext *);
+
+
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* REMPLACEMENT D'OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour les tâches de résolutions différées. */
+G_DEFINE_TYPE(GDexResolverWork, g_dex_resolver_work, G_TYPE_DELAYED_WORK);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des résolutions d'opérandes différées. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dex_resolver_work_class_init(GDexResolverWorkClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : disass = instance à initialiser. *
+* *
+* Description : Initialise une tâche de résolution d'opérandes différée. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dex_resolver_work_init(GDexResolverWork *disass)
+{
+ G_DELAYED_WORK(disass)->run = (run_task_fc)g_dex_resolver_work_process;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : binary = binaire chargé en attente des résultats. *
+* *
+* Description : Crée une tâche de résolution d'opérandes différée. *
+* *
+* Retour : Tâche créée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GDexResolverWork *g_dex_resolver_work_new(GOpenidaBinary *binary)
+{
+ GDexResolverWork *result; /* Tâche à retourner */
+
+ result = g_object_new(G_TYPE_DEX_RESOLVER_WORK, NULL);
+
+ result->binary = binary;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : work = analyse à mener. *
+* statusbar = barre de statut à tenir informée. *
+* *
+* Description : Assure la résolution d'opérandes en différé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dex_resolver_work_process(GDexResolverWork *work, GtkExtStatusBar *statusbar)
+{
+ GDexFormat *format; /* Format du binaire utilisé */
+ GRenderingLine *lines; /* Lignes désassemblées */
+ GRenderingLine *iter; /* Boucle de parcours */
+ GArchInstruction *instr; /* Instruction à ausculter */
+ size_t count; /* Quantité d'opérandes */
+ size_t i; /* Boucle de parcours */
+ const GArchOperand *op; /* Opérande à analyser */
+ GArchOperand *new; /* Nouvel opérande à afficher */
+
+ format = G_DEX_FORMAT(g_openida_binary_get_format(work->binary));
+
+ lines = g_openida_binary_get_lines(work->binary);
+
+ for (iter = lines;
+ iter != NULL;
+ iter = g_rendering_line_get_next_iter(lines, iter, NULL))
+ {
+ /* On ne traite que du code ici ! */
+ if (!G_IS_CODE_LINE(iter)) continue;
+
+ instr = g_code_line_get_instruction(G_CODE_LINE(iter));
+ count = g_arch_instruction_count_operands(instr);
+
+ for (i = 0; i < count; i++)
+ {
+ op = g_arch_instruction_get_operand(instr, i);
+
+ if (G_IS_DALVIK_POOL_OPERAND(op))
+ {
+ new = g_dalvik_hpool_operand_new(format, G_DALVIK_POOL_OPERAND(op));
+
+ if (new != NULL)
+ g_arch_instruction_replace_operand(instr, new, op);
+
+ }
+
+ }
+
+ }
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* REMPLACEMENT D'OPERANDES */
+/* REMPLACEMENT D'OPERANDES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une instance de greffon. */
+G_DEFINE_TYPE(GDexResolverContext, g_dex_resolver_context, G_TYPE_PLUGIN_CONTEXT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des instances de greffon. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dex_resolver_context_class_init(GDexResolverContextClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : context = instance à initialiser. *
+* *
+* Description : Initialise une instance d'instance de greffon. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dex_resolver_context_init(GDexResolverContext *context)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : binary = contenu binaire chargé à traiter. *
+* *
+* Description : Lance l'exécution d'une action du greffon. *
+* *
+* Retour : Instance d'exécution du greffon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GPluginContext *g_dex_resolver_context_new(GOpenidaBinary *binary)
+{
+ GPluginContext *result; /* Bilan d'exécution à renvoyer*/
+ GDexResolverWork *work; /* Tâche de parcours de lignes */
+
+ result = g_object_new(G_TYPE_DEX_RESOLVER_CONTEXT, NULL);
+
+ work = g_dex_resolver_work_new(binary);
+
+ g_signal_connect(work, "work-completed", G_CALLBACK(g_object_unref), NULL);
+
+ g_work_queue_schedule_work(get_work_queue(), G_DELAYED_WORK(work));
+
+ return result;
+
+}
diff --git a/plugins/dexresolver/context.h b/plugins/dexresolver/context.h
new file mode 100644
index 0000000..79e4204
--- /dev/null
+++ b/plugins/dexresolver/context.h
@@ -0,0 +1,57 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * context.h - prototypes pour les instances d'actions du présent greffon
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _PLUGINS_DEXRESOLVER_CONTEXT_H
+#define _PLUGINS_DEXRESOLVER_CONTEXT_H
+
+
+#include <analysis/binary.h>
+#include <plugins/context.h>
+
+
+
+/* Instance du greffon pour OpenIDA (instance) */
+typedef struct _GDexResolverContext GDexResolverContext;
+
+/* Instance du greffon pour OpenIDA (classe) */
+typedef struct _GDexResolverContextClass GDexResolverContextClass;
+
+
+#define G_TYPE_DEX_RESOLVER_CONTEXT (g_dex_resolver_context_get_type())
+#define G_DEX_RESOLVER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContext))
+#define G_IS_DEX_RESOLVER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_DEX_RESOLVER_CONTEXT))
+#define G_DEX_RESOLVER_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContextClass))
+#define G_IS_DEX_RESOLVER_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DEX_RESOLVER_CONTEXT))
+#define G_DEX_RESOLVER_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContextClass))
+
+
+/* Indique le type défini pour une instance de greffon. */
+GType g_dex_resolver_context_get_type(void);
+
+/* Lance l'exécution d'une action du greffon. */
+GPluginContext *g_dex_resolver_context_new(GOpenidaBinary *);
+
+
+
+#endif /* _PLUGINS_DEXRESOLVER_CONTEXT_H */
diff --git a/plugins/dexresolver/operand.c b/plugins/dexresolver/operand.c
new file mode 100644
index 0000000..17adaf6
--- /dev/null
+++ b/plugins/dexresolver/operand.c
@@ -0,0 +1,306 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * operand.c - remplacement d'opérandes par d'autres plus explicites
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 "operand.h"
+
+
+#include <string.h>
+
+
+#include <arch/operand-int.h>
+#include <format/dex/pool.h>
+
+
+
+/* ----------------- OPERANDES POINTANT VERS LA TABLE DE CONSTANTES ----------------- */
+
+
+/* Définition d'un opérande visant un élément de table de constantes Dalvik (instance) */
+struct _GDalvikHPoolOperand
+{
+ GArchOperand parent; /* Instance parente */
+
+ const GDexFormat *format; /* Format de binaire utilisé */
+ const GDalvikPoolOperand *child; /* Opérande encapsulé */
+
+ union
+ {
+ GBinVariable *field; /* Champ à représenter */
+ GBinRoutine *method; /* Méthode à représenter */
+
+ } cache;
+
+};
+
+
+/* Définition d'un opérande visant un élément de table de constantes Dalvik (classe) */
+struct _GDalvikHPoolOperandClass
+{
+ GArchOperandClass parent; /* Classe parente */
+
+};
+
+
+/* Initialise la classe des opérandes de constante Dalvik. */
+static void g_dalvik_hpool_operand_class_init(GDalvikHPoolOperandClass *);
+
+/* Initialise une instance d'opérande de constante Dalvik. */
+static void g_dalvik_hpool_operand_init(GDalvikHPoolOperand *);
+
+/* Ajoute du texte simple à un fichier ouvert en écriture. */
+static void g_dalvik_hpool_operand_add_text(const GDalvikHPoolOperand *, GRenderingOptions *, MainRendering, FILE *);
+
+/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
+static void g_dalvik_hpool_operand_to_buffer(/*const */GDalvikHPoolOperand *, GBufferLine *, GRenderingOptions *);
+
+
+
+
+
+
+
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* OPERANDES POINTANT VERS LA TABLE DE CONSTANTES */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini par la GLib pour un un élément de table de constantes Dalvik. */
+G_DEFINE_TYPE(GDalvikHPoolOperand, g_dalvik_hpool_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des opérandes de constante Dalvik. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dalvik_hpool_operand_class_init(GDalvikHPoolOperandClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = instance à initialiser. *
+* *
+* Description : Initialise une instance d'opérande de constante Dalvik. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dalvik_hpool_operand_init(GDalvikHPoolOperand *operand)
+{
+ GContentExporter *parent; /* Instance parente */
+
+ parent = G_CONTENT_EXPORTER(operand);
+
+ parent->add_text = (add_text_fc)g_dalvik_hpool_operand_add_text;
+ parent->export_buffer = (export_buffer_fc)g_dalvik_hpool_operand_to_buffer;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : format = représentation interne du format DEX à consulter. *
+* child = instance existante à encapsuler. *
+* *
+* Description : Crée un opérande explicitant l'usage d'un élément constant. *
+* *
+* Retour : Opérande mis en place ou NULL si soucis. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GArchOperand *g_dalvik_hpool_operand_new(const GDexFormat *format, const GDalvikPoolOperand *child)
+{
+ GDalvikHPoolOperand *result; /* Structure à retourner */
+
+ if (g_dalvik_pool_operand_get_pool_type(child) == DPT_NONE)
+ return NULL;
+
+ result = g_object_new(G_TYPE_DALVIK_HPOOL_OPERAND, NULL);
+
+ result->format = format;
+ result->child = child;
+
+ return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à transcrire. *
+* options = options de rendu. *
+* rendering = support effectif final des lignes de code. *
+* stream = flux ouvert en écriture. *
+* *
+* Description : Ajoute du texte simple à un fichier ouvert en écriture. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dalvik_hpool_operand_add_text(const GDalvikHPoolOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
+{
+ //g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->reg), options, rendering, stream);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : operand = opérande à transcrire. *
+* buffer = espace où placer ledit contenu. *
+* options = options de rendu. *
+* *
+* Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_dalvik_hpool_operand_to_buffer(/*const */GDalvikHPoolOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
+{
+ GContentExporter *exporter; /* Autre vision de l'opérande */
+ uint32_t index; /* Indice de l'élément visé */
+ const char *string; /* Chaîne à afficher */
+ GOpenidaType *type; /* Type quelconque */
+ char *tmp; /* Chaîne à afficher & libérer */
+
+ exporter = G_CONTENT_EXPORTER(operand);
+
+ index = g_dalvik_pool_operand_get_index(operand->child);
+
+ switch (g_dalvik_pool_operand_get_pool_type(operand->child))
+ {
+ case DPT_STRING:
+
+ string = get_string_from_dex_pool(operand->format, index);
+
+ if (string == NULL)
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ "<bad_string_index>", 18, RTT_STRING);
+ else
+ {
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ "\"", 1, RTT_STRING);
+
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ string, strlen(string), RTT_STRING);
+
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ "\"", 1, RTT_STRING);
+
+ }
+
+ break;
+
+ case DPT_FIELD:
+
+ if (operand->cache.field == NULL)
+ operand->cache.field = get_field_from_dex_pool(operand->format, index);
+
+ if (operand->cache.field == NULL)
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ "<bad_field_index>", 17, RTT_VAR_NAME);
+
+ else
+ {
+ type = g_binary_variable_get_vtype(operand->cache.field);
+ tmp = g_openida_type_to_string(type);
+
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ tmp, strlen(tmp), RTT_VAR_NAME);
+
+ free(tmp);
+
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ "->", 2, RTT_LTGT);
+
+ string = g_binary_variable_get_name(operand->cache.field);
+
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ string, strlen(string), RTT_VAR_NAME);
+
+ }
+
+ break;
+
+ case DPT_METHOD:
+
+ if (operand->cache.method == NULL)
+ operand->cache.method = get_routine_from_dex_pool(operand->format, index);
+
+ if (operand->cache.method == NULL)
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ "<bad_method_index>", 18, RTT_VAR_NAME);
+
+ else
+ {
+ tmp = g_binary_routine_to_string(operand->cache.method);
+
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ tmp, strlen(tmp), RTT_VAR_NAME);
+
+ free(tmp);
+
+ }
+
+ break;
+
+ default:
+ g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+ "<-?->", 5, RTT_SECTION);
+ break;
+
+ }
+
+
+
+
+}
+
+
+
+
diff --git a/plugins/dexresolver/operand.h b/plugins/dexresolver/operand.h
new file mode 100644
index 0000000..f5e9ef9
--- /dev/null
+++ b/plugins/dexresolver/operand.h
@@ -0,0 +1,70 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * operand.h - prototypes pour le remplacement d'opérandes par d'autres plus explicites
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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_DEXRESOLVER_OPERAND_H
+#define _PLUGINS_DEXRESOLVER_OPERAND_H
+
+
+#include <glib-object.h>
+
+
+#include <arch/dalvik/operand.h>
+#include <format/dex/dex.h>
+
+
+
+/* ----------------- OPERANDES POINTANT VERS LA TABLE DE CONSTANTES ----------------- */
+
+
+
+#define G_TYPE_DALVIK_HPOOL_OPERAND g_dalvik_hpool_operand_get_type()
+#define G_DALVIK_HPOOL_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dalvik_hpool_operand_get_type(), GDalvikHpoolOperand))
+#define G_IS_DALVIK_HPOOL_OPERAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dalvik_hpool_operand_get_type()))
+#define G_DALVIK_HPOOL_OPERAND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_dalvik_hpool_operand_get_type(), GDalvikHpoolOperandIface))
+
+
+/* Définition d'un opérande visant un élément de table de constantes Dalvik (instance) */
+typedef struct _GDalvikHPoolOperand GDalvikHPoolOperand;
+
+/* Définition d'un opérande visant un élément de table de constantes Dalvik (classe) */
+typedef struct _GDalvikHPoolOperandClass GDalvikHPoolOperandClass;
+
+
+/* Indique le type défini par la GLib pour un un élément de table de constantes Dalvik. */
+GType g_dalvik_hpool_operand_get_type(void);
+
+/* Crée un opérande explicitant l'usage d'un élément constant. */
+GArchOperand *g_dalvik_hpool_operand_new(const GDexFormat *, const GDalvikPoolOperand *);
+
+
+
+
+
+
+
+
+
+
+
+
+#endif /* _PLUGINS_DEXRESOLVER_OPERAND_H */
diff --git a/plugins/dexresolver/plugin.c b/plugins/dexresolver/plugin.c
new file mode 100644
index 0000000..356f7cf
--- /dev/null
+++ b/plugins/dexresolver/plugin.c
@@ -0,0 +1,120 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * plugin.c - résolution des références avec le format DEX
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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 "plugin.h"
+
+
+#include "context.h"
+
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = espace de référencement global. *
+* *
+* Description : Initialise le greffon pour les bornes de routine. *
+* *
+* Retour : true. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+G_MODULE_EXPORT bool init_plugin(GObject *ref)
+{
+ return true;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit une indication sur le(s) type(s) du greffon présent. *
+* *
+* Retour : Description d'un greffon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+G_MODULE_EXPORT PluginType get_plugin_type(void)
+{
+ return PGT_BINARY;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit une indication sur le type d'opération(s) menée(s). *
+* *
+* Retour : Description d'une action. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+G_MODULE_EXPORT PluginAction get_plugin_action(void)
+{
+ return PGA_CODE_PROCESS;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : binary = représentation binaire à traiter. *
+* action = action attendue. *
+* *
+* Description : Exécute une action définie sur un binaire chargé. *
+* *
+* Retour : true si une action a été menée, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginAction action)
+{
+ bool result; /* Bilan à retourner */
+
+
+
+
+ GPluginContext *context;
+
+
+ context = g_dex_resolver_context_new(binary);
+
+ printf("Run it !!!\n");
+
+ result = true;
+
+
+ return result;
+
+}
diff --git a/plugins/dexresolver/plugin.h b/plugins/dexresolver/plugin.h
new file mode 100644
index 0000000..85da278
--- /dev/null
+++ b/plugins/dexresolver/plugin.h
@@ -0,0 +1,49 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * plugin.h - prototypes pour la résolution des références avec le format DEX
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA 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.
+ *
+ * OpenIDA 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_DEXRESOLVER_PLUGIN_H
+#define _PLUGINS_DEXRESOLVER_PLUGIN_H
+
+
+#include <gmodule.h>
+
+
+#include <plugins/plugin-def.h>
+
+
+
+/* Initialise le greffon pour les bornes de routine. */
+G_MODULE_EXPORT bool init_plugin(GObject *);
+
+/* Fournit une indication sur le(s) type(s) du greffon présent. */
+G_MODULE_EXPORT PluginType get_plugin_type(void);
+
+/* Fournit une indication sur le type d'opération(s) menée(s). */
+G_MODULE_EXPORT PluginAction get_plugin_action(void);
+
+/* Exécute une action définie sur un binaire chargé. */
+G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *, PluginAction);
+
+
+
+#endif /* _PLUGINS_DEXRESOLVER_PLUGIN_H */