From 25576d8dd565547fe1178f7faa583a36718f98f8 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Thu, 3 Nov 2016 14:01:40 +0100 Subject: Extended a little bit the Python bindings. --- ChangeLog | 5 +++++ plugins/pychrysa/format/format.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/ChangeLog b/ChangeLog index 22ee8e1..a219511 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 16-11-03 Cyrille Bagard + * plugins/pychrysa/format/format.c: + Extend a little bit the Python bindings. + +16-11-03 Cyrille Bagard + * : Replace all the remaining occurrences of 'OpenIDA' by 'Chrysalide'. diff --git a/plugins/pychrysa/format/format.c b/plugins/pychrysa/format/format.c index 1b129d0..42aed5c 100644 --- a/plugins/pychrysa/format/format.c +++ b/plugins/pychrysa/format/format.c @@ -76,6 +76,9 @@ static PyObject *py_binary_format_find_next_symbol_at(PyObject *, PyObject *); /* Recherche le symbole correspondant à une adresse. */ static PyObject *py_binary_format_resolve_symbol(PyObject *, PyObject *); +/* Fournit une référence vers le contenu binaire analysé. */ +static PyObject *py_binary_format_get_content(PyObject *, void *); + /* Fournit la liste de tous les symboles détectés. */ static PyObject *py_binary_format_get_symbols(PyObject *, void *); @@ -463,6 +466,38 @@ static PyObject *py_binary_format_resolve_symbol(PyObject *self, PyObject *args) /****************************************************************************** * * +* Paramètres : self = objet Python concerné par l'appel. * +* closure = non utilisé ici. * +* * +* Description : Fournit une référence vers le contenu binaire analysé. * +* * +* Retour : Gestionnaire de contenu binaire en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static PyObject *py_binary_format_get_content(PyObject *self, void *closure) +{ + PyObject *result; /* Trouvailles à retourner */ + GBinFormat *format; /* Format de binaire manipulé */ + GBinContent *content; /* Instance GLib correspondante*/ + + format = G_BIN_FORMAT(pygobject_get(self)); + + content = g_binary_format_get_content(format); + + result = pygobject_new(G_OBJECT(content)); + + g_object_unref(content); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : self = classe représentant un format binaire. * * closure = adresse non utilisée ici. * * * @@ -534,6 +569,10 @@ PyTypeObject *get_python_binary_format_type(void) static PyGetSetDef py_bin_format_getseters[] = { { + "content", py_binary_format_get_content, NULL, + "Content of the binary format.", NULL + }, + { "symbols", py_binary_format_get_symbols, NULL, "Iterable list of all symbols found in the binary format.", NULL }, -- cgit v0.11.2-87-g4458