summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/analysis
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/pychrysa/analysis
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/pychrysa/analysis')
-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
4 files changed, 20 insertions, 17 deletions
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 *);