summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-08-12 23:32:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-08-12 23:32:21 (GMT)
commit9cfe738c2e9bb49eb2872e92bc4422c548edb517 (patch)
treeee8dbe5965b9d46394395b8beee87676e098a9f1 /plugins
parentfc49e98dc2b3e0ae08a5874ecacaef046a0f3ec1 (diff)
Cleaned the code and handled file binaries properly.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@259 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins')
-rw-r--r--plugins/dexresolver/context.c12
-rw-r--r--plugins/dexresolver/context.h2
-rw-r--r--plugins/dexresolver/plugin.c2
-rw-r--r--plugins/dexresolver/plugin.h2
-rw-r--r--plugins/pychrysa/analysis/binary.c27
-rw-r--r--plugins/pychrysa/analysis/binary.h2
-rw-r--r--plugins/pychrysa/analysis/py_binary.c6
-rw-r--r--plugins/pychrysa/analysis/py_binary.h2
-rw-r--r--plugins/pychrysa/plugin.c4
-rw-r--r--plugins/stackvars/stackvars.c6
-rw-r--r--plugins/stackvars/stackvars.h2
-rw-r--r--plugins/theseus/theseus.c42
-rw-r--r--plugins/theseus/theseus.h2
13 files changed, 57 insertions, 54 deletions
diff --git a/plugins/dexresolver/context.c b/plugins/dexresolver/context.c
index 19be9c0..b63ccf3 100644
--- a/plugins/dexresolver/context.c
+++ b/plugins/dexresolver/context.c
@@ -51,7 +51,7 @@ typedef struct _GDexResolverWork
{
GDelayedWork parent; /* A laisser en premier */
- GOpenidaBinary *binary; /* Destinataire final */
+ GLoadedBinary *binary; /* Destinataire final */
} GDexResolverWork;
@@ -74,7 +74,7 @@ static void g_dex_resolver_work_class_init(GDexResolverWorkClass *);
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 *);
+static GDexResolverWork *g_dex_resolver_work_new(GLoadedBinary *);
/* Assure la résolution d'opérandes en différé. */
static void g_dex_resolver_work_process(GDexResolverWork *, GtkExtStatusBar *);
@@ -172,7 +172,7 @@ static void g_dex_resolver_work_init(GDexResolverWork *disass)
* *
******************************************************************************/
-static GDexResolverWork *g_dex_resolver_work_new(GOpenidaBinary *binary)
+static GDexResolverWork *g_dex_resolver_work_new(GLoadedBinary *binary)
{
GDexResolverWork *result; /* Tâche à retourner */
@@ -209,9 +209,9 @@ static void g_dex_resolver_work_process(GDexResolverWork *work, GtkExtStatusBar
const GArchOperand *op; /* Opérande à analyser */
GArchOperand *new; /* Nouvel opérande à afficher */
- format = G_DEX_FORMAT(g_openida_binary_get_format(work->binary));
+ format = G_DEX_FORMAT(g_loaded_binary_get_format(work->binary));
- lines = g_openida_binary_get_lines(work->binary);
+ lines = g_loaded_binary_get_lines(work->binary);
for (iter = lines;
iter != NULL;
@@ -303,7 +303,7 @@ static void g_dex_resolver_context_init(GDexResolverContext *context)
* *
******************************************************************************/
-GPluginContext *g_dex_resolver_context_new(GOpenidaBinary *binary)
+GPluginContext *g_dex_resolver_context_new(GLoadedBinary *binary)
{
GPluginContext *result; /* Bilan d'exécution à renvoyer*/
GDexResolverWork *work; /* Tâche de parcours de lignes */
diff --git a/plugins/dexresolver/context.h b/plugins/dexresolver/context.h
index 79e4204..bcc4f19 100644
--- a/plugins/dexresolver/context.h
+++ b/plugins/dexresolver/context.h
@@ -50,7 +50,7 @@ typedef struct _GDexResolverContextClass GDexResolverContextClass;
GType g_dex_resolver_context_get_type(void);
/* Lance l'exécution d'une action du greffon. */
-GPluginContext *g_dex_resolver_context_new(GOpenidaBinary *);
+GPluginContext *g_dex_resolver_context_new(GLoadedBinary *);
diff --git a/plugins/dexresolver/plugin.c b/plugins/dexresolver/plugin.c
index 356f7cf..7a2fe77 100644
--- a/plugins/dexresolver/plugin.c
+++ b/plugins/dexresolver/plugin.c
@@ -98,7 +98,7 @@ G_MODULE_EXPORT PluginAction get_plugin_action(void)
* *
******************************************************************************/
-G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginAction action)
+G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *binary, PluginAction action)
{
bool result; /* Bilan à retourner */
diff --git a/plugins/dexresolver/plugin.h b/plugins/dexresolver/plugin.h
index 85da278..c5a1a97 100644
--- a/plugins/dexresolver/plugin.h
+++ b/plugins/dexresolver/plugin.h
@@ -42,7 +42,7 @@ G_MODULE_EXPORT PluginType get_plugin_type(void);
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);
+G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *, PluginAction);
diff --git a/plugins/pychrysa/analysis/binary.c b/plugins/pychrysa/analysis/binary.c
index 44721b5..93db685 100644
--- a/plugins/pychrysa/analysis/binary.c
+++ b/plugins/pychrysa/analysis/binary.c
@@ -28,6 +28,9 @@
#include <pygobject.h>
+#include <analysis/binaries/file.h> /* REMME ! */
+
+
#include "../quirks.h"
#include "../arch/instruction.h"
#include "../glibext/codebuffer.h"
@@ -70,12 +73,12 @@ static PyObject *py_loaded_binary_new(PyTypeObject *type, PyObject *args, PyObje
PyObject *result; /* Instance à retourner */
char *filename; /* Nom du fichier à charger */
int ret; /* Bilan de lecture des args. */
- GOpenidaBinary *binary; /* Version GLib du format */
+ GLoadedBinary *binary; /* Version GLib du format */
ret = PyArg_ParseTuple(args, "s", &filename);
if (!ret) return Py_None;
- binary = g_openida_binary_new_from_file(filename);
+ binary = g_file_binary_new_from_file(filename);
result = py_loaded_binary_from_c(binary);
g_object_unref(binary);
@@ -97,7 +100,7 @@ static PyObject *py_loaded_binary_new(PyTypeObject *type, PyObject *args, PyObje
* *
******************************************************************************/
-PyObject *py_loaded_binary_from_c(GOpenidaBinary *binary)
+PyObject *py_loaded_binary_from_c(GLoadedBinary *binary)
{
PyObject *module; /* Module d'appartenance */
PyTypeObject *type; /* Type Python correspondant */
@@ -129,12 +132,12 @@ PyObject *py_loaded_binary_from_c(GOpenidaBinary *binary)
static PyObject *py_loaded_binary_get_filename(PyObject *self, PyObject *args)
{
PyObject *result; /* Trouvailles à retourner */
- GOpenidaBinary *binary; /* Version native */
+ GLoadedBinary *binary; /* Version native */
const char *filename; /* Fichier associé au binaire */
- binary = G_OPENIDA_BINARY(pygobject_get(self));
+ binary = G_LOADED_BINARY(pygobject_get(self));
- filename = g_openida_binary_get_filename(binary);
+ filename = g_loaded_binary_get_filename(binary, true);
result = PyString_FromString(filename);
@@ -159,12 +162,12 @@ static PyObject *py_loaded_binary_get_filename(PyObject *self, PyObject *args)
static PyObject *py_loaded_binary_get_instructions(PyObject *self, PyObject *args)
{
PyObject *result; /* Trouvailles à retourner */
- GOpenidaBinary *binary; /* Version native */
+ GLoadedBinary *binary; /* Version native */
GArchInstruction *instr; /* Première instruction */
- binary = G_OPENIDA_BINARY(pygobject_get(self));
+ binary = G_LOADED_BINARY(pygobject_get(self));
- instr = g_openida_binary_get_instructions(binary);
+ instr = g_loaded_binary_get_instructions(binary);
result = py_arch_instruction_from_c(instr);
@@ -192,11 +195,11 @@ static PyObject *py_loaded_binary_get_instructions(PyObject *self, PyObject *arg
static PyObject *py_loaded_binary_get_disassembled_buffer(PyObject *self, void *closure)
{
PyObject *result; /* Trouvailles à retourner */
- GOpenidaBinary *binary; /* Version native */
+ GLoadedBinary *binary; /* Version native */
GCodeBuffer *buffer; /* Tampon à récupérer */
- binary = G_OPENIDA_BINARY(pygobject_get(self));
- buffer = g_openida_binary_get_disassembled_buffer(binary);
+ binary = G_LOADED_BINARY(pygobject_get(self));
+ buffer = g_loaded_binary_get_disassembled_buffer(binary);
result = py_code_buffer_from_c(buffer);
diff --git a/plugins/pychrysa/analysis/binary.h b/plugins/pychrysa/analysis/binary.h
index 89e5e59..33ead7e 100644
--- a/plugins/pychrysa/analysis/binary.h
+++ b/plugins/pychrysa/analysis/binary.h
@@ -34,7 +34,7 @@
/* Crée un nouvel objet Python de type 'LoadedBinary'. */
-PyObject *py_loaded_binary_from_c(GOpenidaBinary *);
+PyObject *py_loaded_binary_from_c(GLoadedBinary *);
/* Prend en charge l'objet 'pychrysalide.analysis.LoadedBinary'. */
bool register_python_loaded_binary(PyObject *);
diff --git a/plugins/pychrysa/analysis/py_binary.c b/plugins/pychrysa/analysis/py_binary.c
index 04d4881..7c1653d 100644
--- a/plugins/pychrysa/analysis/py_binary.c
+++ b/plugins/pychrysa/analysis/py_binary.c
@@ -35,7 +35,7 @@
typedef struct {
PyObject_HEAD
- GOpenidaBinary *binary; /* Instance réelle rattachée */
+ GLoadedBinary *binary; /* Instance réelle rattachée */
} pybinary;
@@ -126,7 +126,7 @@ pybinary_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
* *
******************************************************************************/
-PyObject *pybinary_new_from_existing(GOpenidaBinary *binary)
+PyObject *pybinary_new_from_existing(GLoadedBinary *binary)
{
pybinary *result; /* Nouvelle instance à renvoyer*/
PyTypeObject *type; /* Type d'objet à créer */
@@ -216,7 +216,7 @@ static PyObject *pybinary_get_lines(pybinary *self)
PyObject *result; /* Liste à retourner */
GRenderingLine *lines; /* Liste récupérée à convertir */
- lines = g_openida_binary_get_lines(self->binary);
+ lines = g_loaded_binary_get_lines(self->binary);
result = pyline_new_from_existing(lines, lines);
diff --git a/plugins/pychrysa/analysis/py_binary.h b/plugins/pychrysa/analysis/py_binary.h
index f87d2a5..92c37eb 100644
--- a/plugins/pychrysa/analysis/py_binary.h
+++ b/plugins/pychrysa/analysis/py_binary.h
@@ -35,7 +35,7 @@
/* Initialise le greffon permettant l'usage de Python. */
-PyObject *pybinary_new_from_existing(GOpenidaBinary *);
+PyObject *pybinary_new_from_existing(GLoadedBinary *);
/* Ajoute l'objet 'binary' au module Python. */
bool add_binary_to_python_module(PyObject *);
diff --git a/plugins/pychrysa/plugin.c b/plugins/pychrysa/plugin.c
index 6d8a494..70ca26e 100644
--- a/plugins/pychrysa/plugin.c
+++ b/plugins/pychrysa/plugin.c
@@ -72,7 +72,7 @@ static PluginAction g_python_plugin_get_action(const GPythonPlugin *);
static MatchingFormatAction g_python_plugin_is_matching(const GPythonPlugin *, char **, bin_t **, off_t *);
/* Exécute une action définie sur un binaire chargé. */
-static bool g_python_plugin_execute_on_binary(GPythonPlugin *, GOpenidaBinary *, PluginAction);
+static bool g_python_plugin_execute_on_binary(GPythonPlugin *, GLoadedBinary *, PluginAction);
/* Exécute une action relative à un débogueur. */
@@ -496,7 +496,7 @@ static MatchingFormatAction g_python_plugin_is_matching(const GPythonPlugin *plu
* *
******************************************************************************/
-static bool g_python_plugin_execute_on_binary(GPythonPlugin *plugin, GOpenidaBinary *binary, PluginAction action)
+static bool g_python_plugin_execute_on_binary(GPythonPlugin *plugin, GLoadedBinary *binary, PluginAction action)
{
bool result; /* Bilan à remonter */
PyObject *args; /* Arguments pour l'appel */
diff --git a/plugins/stackvars/stackvars.c b/plugins/stackvars/stackvars.c
index 35f8016..1e18f28 100644
--- a/plugins/stackvars/stackvars.c
+++ b/plugins/stackvars/stackvars.c
@@ -97,7 +97,7 @@ G_MODULE_EXPORT PluginAction get_plugin_action(void)
* *
******************************************************************************/
-G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginAction action)
+G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *binary, PluginAction action)
{
bool result; /* Bilan à retourner */
GRenderingLine *lines; /* Lignes de rendu */
@@ -108,9 +108,9 @@ G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginActi
result = false;
- lines = g_openida_binary_get_lines(binary);
+ lines = g_loaded_binary_get_lines(binary);
- format = g_openida_binary_get_format(binary);
+ format = g_loaded_binary_get_format(binary);
routines = g_binary_format_get_routines(G_BIN_FORMAT(format), &routines_count);
for (i = 0; i < routines_count; i++)
diff --git a/plugins/stackvars/stackvars.h b/plugins/stackvars/stackvars.h
index fdd48b5..bf3e42e 100644
--- a/plugins/stackvars/stackvars.h
+++ b/plugins/stackvars/stackvars.h
@@ -42,7 +42,7 @@ G_MODULE_EXPORT bool init_plugin(GObject *);
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);
+G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *, PluginAction);
diff --git a/plugins/theseus/theseus.c b/plugins/theseus/theseus.c
index 5cc2d98..ea119ef 100644
--- a/plugins/theseus/theseus.c
+++ b/plugins/theseus/theseus.c
@@ -30,7 +30,7 @@
/* Traite en premier lieu les adresses marquées "impératives". */
-static bool register_white_list(GOpenidaBinary *);
+static bool register_white_list(GLoadedBinary *);
/* Indique si une ligne peut faire l'objet d'un nouveau suivi. */
static bool can_line_be_followed(const GRenderingLine *);
@@ -42,13 +42,13 @@ static bool can_line_be_processed(const GRenderingLine *);
static void mark_line_as_done(GRenderingLine *, bool);
/* Suit le flot d'exécution à partir d'un point donné. */
-static bool follow_flow_from_line(GOpenidaBinary *, vmpa_t);
+static bool follow_flow_from_line(GLoadedBinary *, vmpa_t);
/* Désassemble une nouvelle instruction à partir d'une adresse. */
-static GRenderingLine *disassemble_target_address(GOpenidaBinary *, GRenderingLine *, vmpa_t);
+static GRenderingLine *disassemble_target_address(GLoadedBinary *, GRenderingLine *, vmpa_t);
/* Insère dans le flux existant les nouvelles lignes crées. */
-static bool insert_new_lines_into_flow(GOpenidaBinary *, GRenderingLine *, GRenderingLine *);
+static bool insert_new_lines_into_flow(GLoadedBinary *, GRenderingLine *, GRenderingLine *);
@@ -140,7 +140,7 @@ G_MODULE_EXPORT PluginAction get_plugin_action(void)
* *
******************************************************************************/
-G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginAction action)
+G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *binary, PluginAction action)
{
bool result; /* Bilan à retourner */
GRenderingLine *lines; /* Lignes désassemblées */
@@ -153,12 +153,12 @@ G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginActi
GRenderingLine *iter;
- lines = g_openida_binary_get_lines(binary);
+ lines = g_loaded_binary_get_lines(binary);
- format = g_openida_binary_get_format(binary);
+ format = g_loaded_binary_get_format(binary);
start = g_exe_format_get_entry_point(format);
@@ -173,7 +173,7 @@ G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginActi
- options = g_openida_binary_get_options(binary);
+ options = g_loaded_binary_get_options(binary);
for (iter = lines; iter != NULL; iter = g_rendering_line_get_next_iter(lines, iter, NULL))
{
@@ -212,7 +212,7 @@ G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginActi
* *
******************************************************************************/
-static bool register_white_list(GOpenidaBinary *binary)
+static bool register_white_list(GLoadedBinary *binary)
{
bool result; /* Bilan à retourner */
GRenderingLine *lines; /* Lignes désassemblées */
@@ -223,7 +223,7 @@ static bool register_white_list(GOpenidaBinary *binary)
result = true;
- lines = g_openida_binary_get_lines(binary);
+ lines = g_loaded_binary_get_lines(binary);
for (i = 0; i < _white_list_count && result; i++)
{
@@ -327,7 +327,7 @@ static void mark_line_as_done(GRenderingLine *line, bool white)
* *
******************************************************************************/
-static bool follow_flow_from_line(GOpenidaBinary *binary, vmpa_t start)
+static bool follow_flow_from_line(GLoadedBinary *binary, vmpa_t start)
{
bool result; /* Bilan de opérations */
GRenderingLine *lines; /* Lignes désassemblées */
@@ -339,7 +339,7 @@ static bool follow_flow_from_line(GOpenidaBinary *binary, vmpa_t start)
InstructionLinkType type; /* Type de référence */
GRenderingLine *target; /* Ligne visée par la référence*/
- lines = g_openida_binary_get_lines(binary);
+ lines = g_loaded_binary_get_lines(binary);
first = g_rendering_line_find_by_address(lines, NULL, start);
first = g_rendering_line_loop_for_code(first, NULL);
@@ -466,7 +466,7 @@ static bool follow_flow_from_line(GOpenidaBinary *binary, vmpa_t start)
* *
******************************************************************************/
-static GRenderingLine *disassemble_target_address(GOpenidaBinary *binary, GRenderingLine *old, vmpa_t target)
+static GRenderingLine *disassemble_target_address(GLoadedBinary *binary, GRenderingLine *old, vmpa_t target)
{
GRenderingLine *result; /* Lignes en place à renvoyer */
GExeFormat *format; /* Format du binaire fourni */
@@ -482,11 +482,11 @@ static GRenderingLine *disassemble_target_address(GOpenidaBinary *binary, GRende
result = NULL;
- format = g_openida_binary_get_format(binary);
+ format = g_loaded_binary_get_format(binary);
proc = get_arch_processor_from_format(format);
- options = g_openida_binary_get_options(binary);
+ options = g_loaded_binary_get_options(binary);
- data = g_openida_binary_get_data(binary, &length);
+ data = g_loaded_binary_get_data(binary, &length);
old_addr = get_rendering_line_address(old);
if (!g_exe_format_translate_address_into_offset(format, old_addr, &offset))
@@ -532,7 +532,7 @@ static GRenderingLine *disassemble_target_address(GOpenidaBinary *binary, GRende
* *
******************************************************************************/
-static bool insert_new_lines_into_flow(GOpenidaBinary *binary, GRenderingLine *old, GRenderingLine *new)
+static bool insert_new_lines_into_flow(GLoadedBinary *binary, GRenderingLine *old, GRenderingLine *new)
{
bool result; /* Bilan de opérations */
GExeFormat *format; /* Format du binaire fourni */
@@ -551,11 +551,11 @@ static bool insert_new_lines_into_flow(GOpenidaBinary *binary, GRenderingLine *o
GRenderingLine *line; /* Nouvelle ligne de rendu */
GRenderingLine *last; /* Dernière ligne à vérifier */
- format = g_openida_binary_get_format(binary);
+ format = g_loaded_binary_get_format(binary);
proc = get_arch_processor_from_format(format);
- options = g_openida_binary_get_options(binary);
+ options = g_loaded_binary_get_options(binary);
- data = g_openida_binary_get_data(binary, &length);
+ data = g_loaded_binary_get_data(binary, &length);
/* Etendue du bloc de remplacement */
@@ -568,7 +568,7 @@ static bool insert_new_lines_into_flow(GOpenidaBinary *binary, GRenderingLine *o
/* Bourrage nécessaire ? */
- root = g_openida_binary_get_lines_root(binary);
+ root = g_loaded_binary_get_lines_root(binary);
iter = g_rendering_line_find_by_address(*root, NULL, end);
diff --git a/plugins/theseus/theseus.h b/plugins/theseus/theseus.h
index 2fa4ac1..e1a6f36 100644
--- a/plugins/theseus/theseus.h
+++ b/plugins/theseus/theseus.h
@@ -42,7 +42,7 @@ G_MODULE_EXPORT bool init_plugin(GObject *);
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);
+G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *, PluginAction);