summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
8 files changed, 48 insertions, 555 deletions
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"