summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog41
-rw-r--r--configure.ac2
-rw-r--r--plugins/pychrysa/analysis/Makefile.am3
-rw-r--r--plugins/pychrysa/analysis/binaries/Makefile.am14
-rw-r--r--plugins/pychrysa/analysis/binaries/file.c190
-rw-r--r--plugins/pychrysa/analysis/binaries/file.h42
-rw-r--r--plugins/pychrysa/analysis/binaries/module.c89
-rw-r--r--plugins/pychrysa/analysis/binaries/module.h39
-rw-r--r--plugins/pychrysa/analysis/binary.c64
-rw-r--r--plugins/pychrysa/analysis/module.c2
-rwxr-xr-xsrc/analysis/Makefile.am3
-rwxr-xr-xsrc/analysis/binaries/Makefile.am16
-rw-r--r--src/analysis/binaries/file.c369
-rw-r--r--src/analysis/binaries/file.h64
-rw-r--r--src/analysis/binary-int.h90
-rw-r--r--src/analysis/binary.c49
-rw-r--r--src/analysis/binary.h11
-rw-r--r--src/analysis/project.c1
18 files changed, 144 insertions, 945 deletions
diff --git a/ChangeLog b/ChangeLog
index 6b28940..e48637e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,44 @@
+15-09-20 Cyrille Bagard <nocbos@gmail.com>
+
+ * configure.ac:
+ Remove the Makefiles from the 'plugins/pychrysa/analysis/binaries' and
+ 'src/analysis/binaries' directories.
+
+ * plugins/pychrysa/analysis/binaries/file.c:
+ * plugins/pychrysa/analysis/binaries/file.h:
+ * plugins/pychrysa/analysis/binaries/Makefile.am:
+ * plugins/pychrysa/analysis/binaries/module.c:
+ * plugins/pychrysa/analysis/binaries/module.h:
+ Deleted entries.
+
+ * plugins/pychrysa/analysis/binary.c:
+ Allow to create generic binary instances from Python.
+
+ * plugins/pychrysa/analysis/Makefile.am:
+ Remove 'binaries/libpychrysaanalysisbinaries.la' from
+ libpychrysaanalysis_la_LIBADD.
+
+ * plugins/pychrysa/analysis/module.c:
+ Update code.
+
+ * src/analysis/binaries/file.c:
+ * src/analysis/binaries/file.h:
+ * src/analysis/binaries/Makefile.am:
+ Deleted entries.
+
+ * src/analysis/binary.c:
+ * src/analysis/binary.h:
+ Define one unique type to handle binaries.
+
+ * src/analysis/binary-int.h:
+ Deleted entry.
+
+ * src/analysis/Makefile.am:
+ Remove 'binaries/libanalysisbinaries.la' from libanalysis_la_LIBADD.
+
+ * src/analysis/project.c:
+ Update code.
+
15-09-19 Cyrille Bagard <nocbos@gmail.com>
* plugins/devdbg/speed.c:
diff --git a/configure.ac b/configure.ac
index 77b76a7..8b215fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -267,7 +267,6 @@ AC_CONFIG_FILES([Makefile
plugins/mobicore/Makefile
plugins/pychrysa/Makefile
plugins/pychrysa/analysis/Makefile
- plugins/pychrysa/analysis/binaries/Makefile
plugins/pychrysa/analysis/blocks/Makefile
plugins/pychrysa/analysis/contents/Makefile
plugins/pychrysa/analysis/db/Makefile
@@ -296,7 +295,6 @@ AC_CONFIG_FILES([Makefile
plugins/stackvars/Makefile
src/Makefile
src/analysis/Makefile
- src/analysis/binaries/Makefile
src/analysis/blocks/Makefile
src/analysis/contents/Makefile
src/analysis/db/Makefile
diff --git a/plugins/pychrysa/analysis/Makefile.am b/plugins/pychrysa/analysis/Makefile.am
index c014dfd..5b90c07 100644
--- a/plugins/pychrysa/analysis/Makefile.am
+++ b/plugins/pychrysa/analysis/Makefile.am
@@ -9,7 +9,6 @@ libpychrysaanalysis_la_SOURCES = \
routine.h routine.c
libpychrysaanalysis_la_LIBADD = \
- binaries/libpychrysaanalysisbinaries.la \
blocks/libpychrysaanalysisblocks.la \
contents/libpychrysaanalysiscontents.la \
db/libpychrysaanalysisdb.la
@@ -22,4 +21,4 @@ AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJE
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-SUBDIRS = binaries blocks contents db
+SUBDIRS = blocks contents db
diff --git a/plugins/pychrysa/analysis/binaries/Makefile.am b/plugins/pychrysa/analysis/binaries/Makefile.am
deleted file mode 100644
index 03a7aeb..0000000
--- a/plugins/pychrysa/analysis/binaries/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-
-noinst_LTLIBRARIES = libpychrysaanalysisbinaries.la
-
-libpychrysaanalysisbinaries_la_SOURCES =\
- file.h file.c \
- module.h module.c
-
-libpychrysaanalysisbinaries_la_LDFLAGS =
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
- -I../../../../src
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/pychrysa/analysis/binaries/file.c b/plugins/pychrysa/analysis/binaries/file.c
deleted file mode 100644
index 40463ba..0000000
--- a/plugins/pychrysa/analysis/binaries/file.c
+++ /dev/null
@@ -1,190 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * file.c - prototypes pour l'équivalent Python du fichier "analysis/binaries/file.c"
- *
- * Copyright (C) 2012 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * 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 "file.h"
-
-
-#include <pygobject.h>
-
-
-#include <analysis/binaries/file.h>
-
-
-#include "../binary.h"
-
-
-
-/* Crée un nouvel objet Python de type 'BinaryFile'. */
-static PyObject *py_binary_file_new(PyTypeObject *, PyObject *, PyObject *);
-
-/* Fournit le chemin d'accès au binaire représenté. */
-static PyObject *py_binary_file_get_filename(PyObject *, void *);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : type = type de l'objet à instancier. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Crée un nouvel objet Python de type 'BinaryFile'. *
-* *
-* Retour : Instance Python mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_file_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyObject *result; /* Instance à retourner */
- const char *filename; /* Nom du fichier à charger */
- int ret; /* Bilan de lecture des args. */
- GLoadedBinary *binary; /* Version GLib du format */
-
- ret = PyArg_ParseTuple(args, "s", &filename);
- if (!ret) Py_RETURN_NONE;
-
- binary = g_file_binary_new_from_file(filename);
-
- result = pygobject_new(G_OBJECT(binary));
- g_object_unref(binary);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Fournit le chemin d'accès au binaire représenté. *
-* *
-* Retour : Chemin d'accès en Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_file_get_filename(PyObject *self, void *closure)
-{
- const GFileBinary *file; /* Fichier binaire concerné */
- const char *filename; /* Chemin d'accès à diffuser */
-
- file = G_FILE_BINARY(pygobject_get(self));
- filename = g_file_binary_get_filename(file);
-
- return PyUnicode_FromString(filename);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_binary_file_type(void)
-{
- static PyMethodDef py_binary_file_methods[] = {
- { NULL }
- };
-
- static PyGetSetDef py_binary_file_getseters[] = {
- {
- "filename", py_binary_file_get_filename, NULL,
- "Show the filename of the loaded binary file.", NULL
- },
- { NULL }
- };
-
- static PyTypeObject py_binary_file_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.analysis.binaries.BinaryFile",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide binary file",
-
- .tp_methods = py_binary_file_methods,
- .tp_getset = py_binary_file_getseters,
- .tp_new = (newfunc)py_binary_file_new
-
- };
-
- return &py_binary_file_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide.analysis.BinaryFile'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_binary_file(PyObject *module)
-{
- PyTypeObject *py_binary_file_type; /* Type Python 'LoadedBinary' */
- int ret; /* Bilan d'un appel */
- PyObject *dict; /* Dictionnaire du module */
-
- py_binary_file_type = get_python_binary_file_type();
-
- py_binary_file_type->tp_base = get_python_loaded_binary_type();
- py_binary_file_type->tp_basicsize = py_binary_file_type->tp_base->tp_basicsize;
-
- if (PyType_Ready(py_binary_file_type) != 0)
- return false;
-
- Py_INCREF(py_binary_file_type);
- ret = PyModule_AddObject(module, "BinaryFile", (PyObject *)py_binary_file_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "BinaryFile", G_TYPE_FILE_BINARY, py_binary_file_type,
- Py_BuildValue("(O)", py_binary_file_type->tp_base));
-
- return true;
-
-}
diff --git a/plugins/pychrysa/analysis/binaries/file.h b/plugins/pychrysa/analysis/binaries/file.h
deleted file mode 100644
index b381379..0000000
--- a/plugins/pychrysa/analysis/binaries/file.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * file.h - prototypes pour l'équivalent Python du fichier "analysis/binaries/file.h"
- *
- * Copyright (C) 2012 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * 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_PYCHRYSA_ANALYSIS_BINARIES_FILE_H
-#define _PLUGINS_PYCHRYSA_ANALYSIS_BINARIES_FILE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_binary_file_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.analysis.binaries.BinaryFile'. */
-bool register_python_binary_file(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_BINARIES_FILE_H */
diff --git a/plugins/pychrysa/analysis/binaries/module.c b/plugins/pychrysa/analysis/binaries/module.c
deleted file mode 100644
index b43d24f..0000000
--- a/plugins/pychrysa/analysis/binaries/module.c
+++ /dev/null
@@ -1,89 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.c - intégration du répertoire binaries en tant que module
- *
- * Copyright (C) 2012 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * 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 "module.h"
-
-
-#include <assert.h>
-
-
-#include "file.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Ajoute le module 'binaries' au module Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_analysis_binaries_module_to_python_module(PyObject *super)
-{
- bool result; /* Bilan à retourner */
- PyObject *module; /* Sous-module mis en place */
- int ret; /* Bilan d'un appel */
-
- static PyModuleDef py_chrysalide_binaries_module = {
-
- .m_base = PyModuleDef_HEAD_INIT,
-
- .m_name = "pychrysalide.analysis.binaries",
- .m_doc = "Python module for Chrysalide.analysis.binaries",
-
- .m_size = -1,
-
- };
-
- result = false;
-
- module = PyModule_Create(&py_chrysalide_binaries_module);
- if (module == NULL) return false;
-
- ret = PyState_AddModule(super, &py_chrysalide_binaries_module);
- if (ret != 0) goto loading_failed;
-
- ret = _PyImport_FixupBuiltin(module, "pychrysalide.analysis.binaries");
- if (ret != 0) goto loading_failed;
-
- Py_INCREF(module);
- ret = PyModule_AddObject(super, "binaries", module);
- if (ret != 0) goto loading_failed;
-
- result = true;
-
- result &= register_python_binary_file(module);
-
- loading_failed:
-
- assert(result);
-
- return result;
-
-}
diff --git a/plugins/pychrysa/analysis/binaries/module.h b/plugins/pychrysa/analysis/binaries/module.h
deleted file mode 100644
index 653f7da..0000000
--- a/plugins/pychrysa/analysis/binaries/module.h
+++ /dev/null
@@ -1,39 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.h - prototypes pour l'intégration du répertoire binaries en tant que module
- *
- * Copyright (C) 2012 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * 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_PYCHRYSA_ANALYSIS_BINARIES_MODULE_H
-#define _PLUGINS_PYCHRYSA_ANALYSIS_BINARIES_MODULE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Ajoute le module 'binaries' au module Python. */
-bool add_analysis_binaries_module_to_python_module(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_ANALYSIS_BINARIES_MODULE_H */
diff --git a/plugins/pychrysa/analysis/binary.c b/plugins/pychrysa/analysis/binary.c
index fad84cd..31fbfc2 100644
--- a/plugins/pychrysa/analysis/binary.c
+++ b/plugins/pychrysa/analysis/binary.c
@@ -35,12 +35,15 @@
-/* Lance l'analyse d'un élément binaire chargé. */
-static PyObject *py_loaded_binary_analyse(PyObject *, PyObject *);
+/* Crée un nouvel objet Python de type 'LoadedBinary'. */
+static PyObject *py_loaded_binary_new(PyTypeObject *, PyObject *, PyObject *);
/* Fournit le nom associé à l'élément binaire. */
static PyObject *py_loaded_binary_get_name(PyObject *, void *);
+/* Lance l'analyse d'un élément binaire chargé. */
+static PyObject *py_loaded_binary_analyse(PyObject *, PyObject *);
+
/* Fournit le format de fichier reconnu dans le contenu binaire. */
static PyObject *py_loaded_binary_get_format(PyObject *, void *);
@@ -54,26 +57,40 @@ static PyObject *py_loaded_binary_get_disassembled_buffer(PyObject *, void *);
/******************************************************************************
* *
-* Paramètres : self = contenu binaire à manipuler. *
-* args = non utilisé ici. *
+* Paramètres : type = type de l'objet à instancier. *
+* args = arguments fournis à l'appel. *
+* kwds = arguments de type key=val fournis. *
* *
-* Description : Lance l'analyse d'un élément binaire chargé. *
+* Description : Crée un nouvel objet Python de type 'LoadedBinary'. *
* *
-* Retour : Rien (None). *
+* Retour : Instance Python mise en place. *
* *
* Remarques : - *
* *
******************************************************************************/
-static PyObject *py_loaded_binary_analyse(PyObject *self, PyObject *args)
+static PyObject *py_loaded_binary_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
+ PyObject *result; /* Instance à retourner */
+ PyObject *content_obj; /* Objet pour le contenu */
+ int ret; /* Bilan de lecture des args. */
+ GBinContent *content; /* Instance GLib correspondante*/
GLoadedBinary *binary; /* Version GLib du format */
- binary = G_LOADED_BINARY(pygobject_get(self));
+ ret = PyArg_ParseTuple(args, "O", &content_obj);
+ if (!ret) return NULL;
- g_loaded_binary_analyse(binary);
+ ret = PyObject_IsInstance(content_obj, (PyObject *)get_python_binary_content_type());
+ if (!ret) return NULL;
- Py_RETURN_NONE;
+ content = G_BIN_CONTENT(pygobject_get(content_obj));
+ binary = g_loaded_binary_new(content);
+
+ result = pygobject_new(G_OBJECT(binary));
+
+ g_object_unref(binary);
+
+ return result;
}
@@ -110,6 +127,32 @@ static PyObject *py_loaded_binary_get_name(PyObject *self, void *closure)
/******************************************************************************
* *
+* Paramètres : self = contenu binaire à manipuler. *
+* args = non utilisé ici. *
+* *
+* Description : Lance l'analyse d'un élément binaire chargé. *
+* *
+* Retour : Rien (None). *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_loaded_binary_analyse(PyObject *self, PyObject *args)
+{
+ GLoadedBinary *binary; /* Version GLib du format */
+
+ binary = G_LOADED_BINARY(pygobject_get(self));
+
+ g_loaded_binary_analyse(binary);
+
+ Py_RETURN_NONE;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : self = objet Python concerné par l'appel. *
* closure = non utilisé ici. *
* *
@@ -255,6 +298,7 @@ PyTypeObject *get_python_loaded_binary_type(void)
.tp_methods = py_loaded_binary_methods,
.tp_getset = py_loaded_binary_getseters,
+ .tp_new = (newfunc)py_loaded_binary_new
};
diff --git a/plugins/pychrysa/analysis/module.c b/plugins/pychrysa/analysis/module.c
index 2520d42..ea0f34d 100644
--- a/plugins/pychrysa/analysis/module.c
+++ b/plugins/pychrysa/analysis/module.c
@@ -32,7 +32,6 @@
#include "block.h"
#include "content.h"
#include "routine.h"
-#include "binaries/module.h"
#include "blocks/module.h"
#include "contents/module.h"
#include "db/module.h"
@@ -90,7 +89,6 @@ bool add_analysis_module_to_python_module(PyObject *super)
//result &= register_python_binary_content(module);
result &= register_python_binary_routine(module);
- result &= add_analysis_binaries_module_to_python_module(module);
result &= add_analysis_blocks_module_to_python_module(module);
result &= add_analysis_contents_module_to_python_module(module);
result &= add_analysis_db_module_to_python_module(module);
diff --git a/src/analysis/Makefile.am b/src/analysis/Makefile.am
index f3f6e92..0b65bbe 100755
--- a/src/analysis/Makefile.am
+++ b/src/analysis/Makefile.am
@@ -15,7 +15,6 @@ libanalysis_la_SOURCES = \
variable.h variable.c
libanalysis_la_LIBADD = \
- binaries/libanalysisbinaries.la \
blocks/libanalysisblocks.la \
contents/libanalysiscontents.la \
db/libanalysisdb.la \
@@ -30,4 +29,4 @@ AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-SUBDIRS = binaries blocks contents db decomp disass types
+SUBDIRS = blocks contents db decomp disass types
diff --git a/src/analysis/binaries/Makefile.am b/src/analysis/binaries/Makefile.am
deleted file mode 100755
index a30e748..0000000
--- a/src/analysis/binaries/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-
-noinst_LTLIBRARIES = libanalysisbinaries.la
-
-libanalysisbinaries_la_SOURCES = \
- file.h file.c
-
-libanalysisbinaries_la_LIBADD =
-
-libanalysisbinaries_la_LDFLAGS =
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-
-SUBDIRS =
diff --git a/src/analysis/binaries/file.c b/src/analysis/binaries/file.c
deleted file mode 100644
index c31828c..0000000
--- a/src/analysis/binaries/file.c
+++ /dev/null
@@ -1,369 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * file.h - prototypes pour la prise en charge des binaires sous forme de fichier
- *
- * Copyright (C) 2012-2013 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * 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 "file.h"
-
-
-#include <string.h>
-
-
-#include "../binary-int.h"
-#include "../../analysis/contents/file.h"
-#include "../../common/extstr.h"
-#include "../../core/formats.h"
-#include "../../core/processors.h"
-#include "../../gui/panels/log.h"
-
-
-
-/* Description de fichier binaire (instance) */
-struct _GFileBinary
-{
- GLoadedBinary parent; /* A laisser en premier */
-
- char *filename; /* Fichier chargé en mémoire */
-
-};
-
-/* Description de fichier binaire (classe) */
-struct _GFileBinaryClass
-{
- GLoadedBinaryClass parent; /* A laisser en premier */
-
-};
-
-
-/* Initialise la classe des descriptions de fichier binaire. */
-static void g_file_binary_class_init(GFileBinaryClass *);
-
-/* Initialise une description de fichier binaire. */
-static void g_file_binary_init(GFileBinary *);
-
-/* Procède à la libération totale de la mémoire. */
-static void g_file_binary_finalize(GFileBinary *);
-
-/* Ecrit une sauvegarde du binaire dans un fichier XML. */
-static bool g_file_binary_save(const GFileBinary *, xmlDocPtr, xmlXPathContextPtr, const char *);
-
-/* Fournit le nom associé à l'élément binaire. */
-static const char *g_file_binary_get_name(const GFileBinary *, bool);
-
-
-
-/* Indique le type défini pour une description de fichier binaire. */
-G_DEFINE_TYPE(GFileBinary, g_file_binary, G_TYPE_LOADED_BINARY);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des descriptions de fichier binaire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_file_binary_class_init(GFileBinaryClass *klass)
-{
- GObjectClass *object; /* Autre version de la classe */
-
- object = G_OBJECT_CLASS(klass);
-
- object->finalize = (GObjectFinalizeFunc)g_file_binary_finalize;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = instance à initialiser. *
-* *
-* Description : Initialise une description de fichier binaire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_file_binary_init(GFileBinary *binary)
-{
- GLoadedBinary *loaded; /* Version parente */
-
- loaded = G_LOADED_BINARY(binary);
-
- //loaded->save = (save_binary_fc)g_file_binary_save;
- //loaded->get_name = (get_binary_name_fc)g_file_binary_get_name;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = instance d'objet GLib à traiter. *
-* *
-* Description : Procède à la libération totale de la mémoire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_file_binary_finalize(GFileBinary *binary)
-{
- free(binary->filename);
-
- G_OBJECT_CLASS(g_file_binary_parent_class)->finalize(G_OBJECT(binary));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : filename = nom du fichier à charger. *
-* *
-* Description : Charge en mémoire le contenu d'un fichier. *
-* *
-* Retour : Adresse de la représentation ou NULL en cas d'échec. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GLoadedBinary *g_file_binary_new_from_file(const char *filename)
-{
- GFileBinary *result; /* Adresse à retourner */
- GLoadedBinary *loaded; /* Version parente */
- GBinContent *content; /* Contenu binaire chargé */
- const char *target; /* Sous-traitance requise */
- const char *desc; /* Description humaine associée*/
-
- result = g_object_new(G_TYPE_FILE_BINARY, NULL);
- loaded = G_LOADED_BINARY(result);
-
- log_variadic_message(LMT_PROCESS, _("Opening '%s' file..."), filename);
-
- result->filename = strdup(filename);
-
- content = g_file_content_new(filename);
- if (content == NULL) goto lbf_error;
-
- target = "";//find_matching_format(content, NULL);
- desc = get_binary_format_name(target);
-
- if (desc == NULL)
- {
- g_object_unref(G_OBJECT(content));
- log_simple_message(LMT_INFO, _("Unknown binary format"));
- goto lbf_error;
- }
- else
- log_variadic_message(LMT_INFO, _("Detected format: %s"), desc);
-
- loaded->format = G_EXE_FORMAT(load_new_named_format(target, content, NULL));
-
- if (loaded->format == NULL)
- {
- g_object_unref(G_OBJECT(content));
- log_simple_message(LMT_ERROR, _("Error while loading the binary"));
- goto lbf_error;
- }
-
- target = "";//find_matching_format(content, loaded->format);
- desc = get_binary_format_name(target);
-
- if (desc != NULL)
- {
- log_variadic_message(LMT_INFO, _("Detected debug format: %s"), desc);
-
- loaded->debug = G_DBG_FORMAT(load_new_named_format(target, content, loaded->format));
-
- if (loaded->debug == NULL)
- log_simple_message(LMT_ERROR, _("Error while loading the debug information for binary"));
-
- }
-
- target = g_exe_format_get_target_machine(loaded->format);
- desc = get_arch_processor_name(target);
-
- if (desc == NULL)
- {
- g_object_unref(G_OBJECT(loaded->format));
- log_simple_message(LMT_INFO, _("Unknown architecture"));
- goto lbf_error;
- }
- else
- log_variadic_message(LMT_INFO, _("Detected architecture: %s"), desc);
-
- loaded->proc = get_arch_processor_for_type(target);
-
- if (loaded->proc == NULL)
- {
- g_object_unref(G_OBJECT(loaded->format));
- log_simple_message(LMT_ERROR, _("Unable to load the required processor"));
- goto lbf_error;
- }
-
- return G_LOADED_BINARY(result);
-
- lbf_error:
-
- g_object_unref(G_OBJECT(result));
-
- return NULL;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : context = contexte pour les recherches XPath. *
-* path = chemin d'accès au noeud XML à lire. *
-* *
-* Description : Charge en mémoire le contenu d'un fichier à partir d'XML. *
-* *
-* Retour : Adresse de la représentation ou NULL en cas d'échec. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GLoadedBinary *g_file_binary_new_from_xml(xmlXPathContextPtr context, const char *path)
-{
- GLoadedBinary *result; /* Adresse à retourner */
- char *access; /* Chemin pour une sous-config.*/
- char *filename; /* Chemin du binaire à charger */
-
- result = NULL;
-
- /* Chemin du fichier à retrouver */
-
- access = strdup(path);
- access = stradd(access, "/Filename");
-
- filename = get_node_text_value(context, access);
-
- free(access);
-
- /* Chargement */
-
- if (filename != NULL)
- {
- result = g_file_binary_new_from_file(filename);
- free(filename);
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = élément binaire à traiter. *
-* xdoc = structure XML en cours d'édition. *
-* context = contexte à utiliser pour les recherches. *
-* path = chemin d'accès réservé au binaire. *
-* *
-* Description : Ecrit une sauvegarde du binaire dans un fichier XML. *
-* *
-* Retour : true si l'opération a bien tourné, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_file_binary_save(const GFileBinary *binary, xmlDocPtr xdoc, xmlXPathContextPtr context, const char *path)
-{
- bool result; /* Bilan à faire remonter */
- char *access; /* Chemin d'accès à un élément */
-
- result = true;
-
- /* Type */
-
- result &= add_string_attribute_to_node(xdoc, context, path, "type", "file");
-
- /* Nom du fichier associé */
-
- access = strdup(path);
- access = stradd(access, "/Filename");
-
- result &= add_content_to_node(xdoc, context, access, binary->filename);
-
- free(access);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = élément binaire à consulter. *
-* full = précise s'il s'agit d'une version longue ou non. *
-* *
-* Description : Fournit le nom associé à l'élément binaire. *
-* *
-* Retour : Nom de fichier avec chemin absolu. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static const char *g_file_binary_get_name(const GFileBinary *binary, bool full)
-{
- const char *result; /* Description à retourner */
-
- if (full)
- result = binary->filename;
- else
- result = strrchr(binary->filename, G_DIR_SEPARATOR) + 1;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = élément binaire à consulter. *
-* *
-* Description : Fournit le fichier correspondant à l'élément binaire. *
-* *
-* Retour : Nom de fichier avec chemin absolu. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-const char *g_file_binary_get_filename(const GFileBinary *binary)
-{
- return binary->filename;
-
-}
diff --git a/src/analysis/binaries/file.h b/src/analysis/binaries/file.h
deleted file mode 100644
index 63f7e7c..0000000
--- a/src/analysis/binaries/file.h
+++ /dev/null
@@ -1,64 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * file.h - prototypes pour la prise en charge des binaires sous forme de fichier
- *
- * Copyright (C) 2012 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * 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 _ANALYSIS_BINARIES_FILE_H
-#define _ANALYSIS_BINARIES_FILE_H
-
-
-#include <glib-object.h>
-
-
-#include "../binary.h"
-#include "../../common/xml.h"
-
-
-
-#define G_TYPE_FILE_BINARY g_file_binary_get_type()
-#define G_FILE_BINARY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_file_binary_get_type(), GFileBinary))
-#define G_IS_FILE_BINARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_file_binary_get_type()))
-#define G_FILE_BINARY_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_file_binary_get_type(), GFileBinaryIface))
-#define G_FILE_BINARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_FILE_BINARY, GFileBinaryClass))
-
-
-/* Description de fichier binaire (instance) */
-typedef struct _GFileBinary GFileBinary;
-
-/* Description de fichier binaire (classe) */
-typedef struct _GFileBinaryClass GFileBinaryClass;
-
-
-/* Indique le type défini pour une description de fichier binaire. */
-GType g_file_binary_get_type(void);
-
-/* Charge en mémoire le contenu d'un fichier. */
-GLoadedBinary *g_file_binary_new_from_file(const char *);
-
-/* Charge en mémoire le contenu d'un fichier à partir d'XML. */
-GLoadedBinary *g_file_binary_new_from_xml(xmlXPathContextPtr, const char *);
-
-/* Fournit le fichier correspondant à l'élément binaire. */
-const char *g_file_binary_get_filename(const GFileBinary *);
-
-
-
-#endif /* _ANALYSIS_BINARIES_FILE_H */
diff --git a/src/analysis/binary-int.h b/src/analysis/binary-int.h
deleted file mode 100644
index 60b9662..0000000
--- a/src/analysis/binary-int.h
+++ /dev/null
@@ -1,90 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * binary-int.h - prototypes pour la définition interne des binaires
- *
- * Copyright (C) 2012-2014 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * 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 _ANALYSIS_BINARY_INT_H
-#define _ANALYSIS_BINARY_INT_H
-
-
-#include "binary.h"
-
-
-#include "db/client.h"
-#include "../format/format.h"
-
-
-
-/* Fournit le fichier correspondant à l'élément binaire. */
-typedef const char * (* get_binary_name_fc) (const GLoadedBinary *, bool); //// REMME
-
-
-/* Description de fichier binaire (instance) */
-struct _GLoadedBinary
-{
- GObject parent; /* A laisser en premier */
-
- char *username; /* Identifiant de l'utilisateur*/
- bool username_changed; /* Mémorise les changements */
- char *remote_host; /* Nom du serveur distant */
- unsigned short remote_port; /* Port du serveur distant */
- bool use_remote_server; /* Indique une utilisation */
-
- GDbClient *local; /* Enregistrements locaux */
- GDbClient *remote; /* Enregistrements distants */
-
- DBStorage storages[DBF_COUNT]; /* Lieux d'enregistrement */
- GList *collections; /* Ensemble de modifications */
-
- get_binary_name_fc get_name; /* Obtention d'une description */ //// REMME
-
- GBinContent *content; /* Contenu binaire chargé */ //// REMME
-
- GExeFormat *format; /* Format du binaire */
- GDbgFormat *debug; /* Informations de débogage */ //// REMME
- GArchProcessor *proc; /* Architecture du binaire */
-
- GArchInstruction *instrs; /* Instructions d'assemblage */
- GCodeBuffer *disass_buffer; /* Instructions lisibles */
- GCodeBuffer **dec_buffers; /* Sources sous forme de texte */
- size_t decbuf_count; /* Taille des tableaux */
- size_t defsrc; /* Fichier source principal */
-
- bool col_display[BVW_COUNT][BLC_DISPLAY];/* Position et code binaire */
- bool lines_display; /* Affichage des lignes */
-
-};
-
-/* Description de fichier binaire (classe) */
-struct _GLoadedBinaryClass
-{
- GObjectClass parent; /* A laisser en premier */
-
- /* Signaux */
-
- void (* disassembly_done) (GLoadedBinary *);
- void (* display_changed) (GLoadedBinary *, BinaryView, BufferLineColumn);
-
-};
-
-
-
-#endif /* _ANALYSIS_BINARY_INT_H */
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index c94f4f6..a1eb09f 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -35,9 +35,8 @@
#include <i18n.h>
-#include "binary-int.h"
#include "routine.h"
-#include "binaries/file.h"
+#include "db/client.h"
#include "decomp/decompiler.h"
#include "disass/disassembler.h"
#include "../common/extstr.h"
@@ -54,6 +53,52 @@
/* ------------------------ DESASSEMBLAGE DE BINAIRE DIFFERE ------------------------ */
+/* Description de fichier binaire (instance) */
+struct _GLoadedBinary
+{
+ GObject parent; /* A laisser en premier */
+
+ char *username; /* Identifiant de l'utilisateur*/
+ bool username_changed; /* Mémorise les changements */
+ char *remote_host; /* Nom du serveur distant */
+ unsigned short remote_port; /* Port du serveur distant */
+ bool use_remote_server; /* Indique une utilisation */
+
+ GDbClient *local; /* Enregistrements locaux */
+ GDbClient *remote; /* Enregistrements distants */
+
+ DBStorage storages[DBF_COUNT]; /* Lieux d'enregistrement */
+ GList *collections; /* Ensemble de modifications */
+
+ GBinContent *content; /* Contenu binaire chargé */ //// REMME
+
+ GExeFormat *format; /* Format du binaire */
+ GDbgFormat *debug; /* Informations de débogage */ //// REMME
+ GArchProcessor *proc; /* Architecture du binaire */
+
+ GArchInstruction *instrs; /* Instructions d'assemblage */
+ GCodeBuffer *disass_buffer; /* Instructions lisibles */
+ GCodeBuffer **dec_buffers; /* Sources sous forme de texte */
+ size_t decbuf_count; /* Taille des tableaux */
+ size_t defsrc; /* Fichier source principal */
+
+ bool col_display[BVW_COUNT][BLC_DISPLAY];/* Position et code binaire */
+ bool lines_display; /* Affichage des lignes */
+
+};
+
+/* Description de fichier binaire (classe) */
+struct _GLoadedBinaryClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+ /* Signaux */
+
+ void (* disassembly_done) (GLoadedBinary *);
+ void (* display_changed) (GLoadedBinary *, BinaryView, BufferLineColumn);
+
+};
+
/* Initialise la classe des descriptions de fichier binaire. */
static void g_loaded_binary_class_init(GLoadedBinaryClass *);
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 4ef3a0d..a725110 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -53,17 +53,6 @@ typedef struct _GStudyProject GStudyProject;
#define G_LOADED_BINARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_LOADED_BINARY, GLoadedBinaryClass))
-
-
-
-
-#define G_TYPE_LOADED_BINARY g_loaded_binary_get_type()
-#define G_LOADED_BINARY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_loaded_binary_get_type(), GLoadedBinary))
-#define G_IS_LOADED_BINARY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_loaded_binary_get_type()))
-#define G_LOADED_BINARY_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_loaded_binary_get_type(), GLoadedBinaryIface))
-#define G_LOADED_BINARY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_LOADED_BINARY, GLoadedBinaryClass))
-
-
/* Description de fichier binaire (instance) */
typedef struct _GLoadedBinary GLoadedBinary;
diff --git a/src/analysis/project.c b/src/analysis/project.c
index db00f09..616d854 100644
--- a/src/analysis/project.c
+++ b/src/analysis/project.c
@@ -32,7 +32,6 @@
#include <i18n.h>
-#include "binaries/file.h"
#include "../common/xml.h"
#include "../core/formats.h"
#include "../core/params.h"