summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog31
-rw-r--r--plugins/pychrysa/analysis/binaries/file.c2
-rw-r--r--plugins/pychrysa/analysis/binary.c4
-rw-r--r--src/analysis/binaries/file.c28
-rw-r--r--src/analysis/binaries/file.h2
-rw-r--r--src/analysis/binary-int.h4
-rw-r--r--src/analysis/binary.c6
-rw-r--r--src/analysis/binary.h4
-rw-r--r--src/analysis/disass/disassembler.c2
-rw-r--r--src/dialogs/export.c2
-rw-r--r--src/dialogs/shellcode.c4
-rw-r--r--src/gtkext/gtkdockstation.c19
-rw-r--r--src/gtkext/gtkdockstation.h2
-rw-r--r--src/gui/menus/project.c2
-rw-r--r--src/gui/panels/panel.c5
-rw-r--r--src/project.c8
16 files changed, 91 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 69620f1..470aef1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,36 @@
14-06-25 Cyrille Bagard <nocbos@gmail.com>
+ * plugins/pychrysa/analysis/binaries/file.c:
+ * plugins/pychrysa/analysis/binary.c:
+ * src/analysis/binaries/file.c:
+ * src/analysis/binaries/file.h:
+ Update code.
+
+ * src/analysis/binary.c:
+ * src/analysis/binary.h:
+ * src/analysis/binary-int.h:
+ Give a name and a description for binaries, not always based on a filenames.
+
+ * src/analysis/disass/disassembler.c:
+ * src/dialogs/export.c:
+ * src/dialogs/shellcode.c:
+ Update code.
+
+ * src/gtkext/gtkdockstation.c:
+ * src/gtkext/gtkdockstation.h:
+ Use a long description for docked widgets.
+
+ * src/gui/menus/project.c:
+ Update code.
+
+ * src/gui/panels/panel.c:
+ Use the stored description.
+
+ * src/project.c:
+ Update code.
+
+14-06-25 Cyrille Bagard <nocbos@gmail.com>
+
* configure.ac:
Update version and look for python3 + pygobject-3.0.
diff --git a/plugins/pychrysa/analysis/binaries/file.c b/plugins/pychrysa/analysis/binaries/file.c
index 28bfecb..e5cc2f1 100644
--- a/plugins/pychrysa/analysis/binaries/file.c
+++ b/plugins/pychrysa/analysis/binaries/file.c
@@ -96,7 +96,7 @@ static PyObject *py_binary_file_get_filename(PyObject *self, void *closure)
const char *filename; /* Chemin d'accès à diffuser */
file = G_FILE_BINARY(pygobject_get(self));
- filename = g_file_binary_get_filename(file, true);
+ filename = g_file_binary_get_filename(file);
return PyUnicode_FromString(filename);
diff --git a/plugins/pychrysa/analysis/binary.c b/plugins/pychrysa/analysis/binary.c
index 807df7e..1a513eb 100644
--- a/plugins/pychrysa/analysis/binary.c
+++ b/plugins/pychrysa/analysis/binary.c
@@ -167,7 +167,7 @@ static PyObject *py_loaded_binary_get_disassembled_buffer(PyObject *, void *);
* *
******************************************************************************/
-static PyObject *py_loaded_binary_get_filename(PyObject *self, PyObject *args)
+static PyObject *py_loaded_binary_get_name(PyObject *self, PyObject *args)
{
PyObject *result; /* Trouvailles à retourner */
GLoadedBinary *binary; /* Version native */
@@ -175,7 +175,7 @@ static PyObject *py_loaded_binary_get_filename(PyObject *self, PyObject *args)
binary = G_LOADED_BINARY(pygobject_get(self));
- filename = g_loaded_binary_get_filename(binary, true);
+ filename = g_loaded_binary_get_name(binary, true);
result = PyString_FromString(filename);
diff --git a/src/analysis/binaries/file.c b/src/analysis/binaries/file.c
index ad140ab..d833828 100644
--- a/src/analysis/binaries/file.c
+++ b/src/analysis/binaries/file.c
@@ -66,6 +66,9 @@ 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. */
@@ -115,7 +118,7 @@ static void g_file_binary_init(GFileBinary *binary)
loaded = G_LOADED_BINARY(binary);
loaded->save = (save_binary_fc)g_file_binary_save;
- loaded->get_filename = (get_binary_filename_fc)g_file_binary_get_filename;
+ loaded->get_name = (get_binary_name_fc)g_file_binary_get_name;
}
@@ -337,7 +340,7 @@ static bool g_file_binary_save(const GFileBinary *binary, xmlDocPtr xdoc, xmlXPa
* Paramètres : binary = élément binaire à consulter. *
* full = précise s'il s'agit d'une version longue ou non. *
* *
-* Description : Fournit le fichier correspondant à l'élément binaire. *
+* Description : Fournit le nom associé à l'élément binaire. *
* *
* Retour : Nom de fichier avec chemin absolu. *
* *
@@ -345,7 +348,7 @@ static bool g_file_binary_save(const GFileBinary *binary, xmlDocPtr xdoc, xmlXPa
* *
******************************************************************************/
-const char *g_file_binary_get_filename(const GFileBinary *binary, bool full)
+static const char *g_file_binary_get_name(const GFileBinary *binary, bool full)
{
const char *result; /* Description à retourner */
@@ -357,3 +360,22 @@ const char *g_file_binary_get_filename(const GFileBinary *binary, bool full)
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
index 40bc722..63f7e7c 100644
--- a/src/analysis/binaries/file.h
+++ b/src/analysis/binaries/file.h
@@ -57,7 +57,7 @@ GLoadedBinary *g_file_binary_new_from_file(const char *);
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 *, bool);
+const char *g_file_binary_get_filename(const GFileBinary *);
diff --git a/src/analysis/binary-int.h b/src/analysis/binary-int.h
index 7c4b05e..8aa2e83 100644
--- a/src/analysis/binary-int.h
+++ b/src/analysis/binary-int.h
@@ -37,7 +37,7 @@
typedef bool (* save_binary_fc) (const GLoadedBinary *, xmlDocPtr, xmlXPathContextPtr, const char *);
/* Fournit le fichier correspondant à l'élément binaire. */
-typedef const char * (* get_binary_filename_fc) (const GLoadedBinary *, bool);
+typedef const char * (* get_binary_name_fc) (const GLoadedBinary *, bool);
/* Description de fichier binaire (instance) */
@@ -56,7 +56,7 @@ struct _GLoadedBinary
DBStorage storages[DBF_COUNT]; /* Lieux d'enregistrement */
save_binary_fc save; /* Sauvegarde au format XML */
- get_binary_filename_fc get_filename; /* Obtention d'une description */
+ get_binary_name_fc get_name; /* Obtention d'une description */
off_t bin_length; /* Taille des données brutes */
bin_t *bin_data; /* Données binaires brutes */
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index db6cbae..a9379e9 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -992,7 +992,7 @@ void g_loaded_binary_analyse(GLoadedBinary *binary)
* Paramètres : binary = élément binaire à consulter. *
* full = précise s'il s'agit d'une version longue ou non. *
* *
-* Description : Fournit le fichier correspondant à l'élément binaire. *
+* Description : Fournit le nom associé à l'élément binaire. *
* *
* Retour : Nom de fichier avec chemin absolu. *
* *
@@ -1000,9 +1000,9 @@ void g_loaded_binary_analyse(GLoadedBinary *binary)
* *
******************************************************************************/
-const char *g_loaded_binary_get_filename(const GLoadedBinary *binary, bool full)
+const char *g_loaded_binary_get_name(const GLoadedBinary *binary, bool full)
{
- return binary->get_filename(binary, full);
+ return binary->get_name(binary, full);
}
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 5b65fa8..f3e2d09 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -119,8 +119,8 @@ GBinPart ***g_loaded_binary_get_parts(const GLoadedBinary *, BinaryPartModel *,
/* Lance l'analyse d'un élément binaire chargé. */
void g_loaded_binary_analyse(GLoadedBinary *);
-/* Fournit le fichier correspondant à l'élément binaire. */
-const char *g_loaded_binary_get_filename(const GLoadedBinary *, bool);
+/* Fournit le nom associé à l'élément binaire. */
+const char *g_loaded_binary_get_name(const GLoadedBinary *, bool);
/* Fournit une empreinte unique (SHA256) pour le binaire. */
const gchar *g_loaded_binary_get_cheksum(const GLoadedBinary *);
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index 2f430eb..8020e02 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -427,7 +427,7 @@ void disassemble_binary(GLoadedBinary *binary, GBinPart **parts, size_t parts_co
*buffer = g_code_buffer_new(BLC_ASSEMBLY);
data = g_loaded_binary_get_data(binary, &length);
- build_disass_prologue(*buffer, g_loaded_binary_get_filename(binary, true), data, length);
+ build_disass_prologue(*buffer, g_loaded_binary_get_name(binary, true), data, length);
disass = g_delayed_disassembly_new(binary, parts, parts_count, instrs, *buffer);
g_signal_connect(disass, "work-completed", G_CALLBACK(ack), binary);
diff --git a/src/dialogs/export.c b/src/dialogs/export.c
index a29f95f..25d62a7 100644
--- a/src/dialogs/export.c
+++ b/src/dialogs/export.c
@@ -328,7 +328,7 @@ static void register_output_panel(GtkAssistant *assistant)
/* Choix par défaut */
binary = G_LOADED_BINARY(g_object_get_data(G_OBJECT(assistant), "binary"));
- filename = g_loaded_binary_get_filename(binary, true);
+ filename = g_loaded_binary_get_name(binary, true);
gtk_entry_set_text(GTK_ENTRY(entry), filename);
gtk_editable_insert_text(GTK_EDITABLE(entry), ".txt", -1, (gint []) { strlen(filename) });
diff --git a/src/dialogs/shellcode.c b/src/dialogs/shellcode.c
index fb1499d..2f43d99 100644
--- a/src/dialogs/shellcode.c
+++ b/src/dialogs/shellcode.c
@@ -634,7 +634,7 @@ static void register_output_panel(GtkAssistant *assistant)
/* Choix par défaut */
/*
binary = G_LOADED_BINARY(g_object_get_data(G_OBJECT(assistant), "binary"));
- filename = g_loaded_binary_get_filename(binary);
+ filename = g_loaded_binary_get_name(binary);
gtk_entry_set_text(GTK_ENTRY(entry), filename);
gtk_entry_append_text(GTK_ENTRY(entry), ".txt");
@@ -813,7 +813,7 @@ static void register_content_panel(GtkAssistant *assistant)
/* Choix par défaut */
/*
binary = G_LOADED_BINARY(g_object_get_data(G_OBJECT(assistant), "binary"));
- filename = g_loaded_binary_get_filename(binary);
+ filename = g_loaded_binary_get_name(binary);
gtk_entry_set_text(GTK_ENTRY(entry), filename);
gtk_entry_append_text(GTK_ENTRY(entry), ".txt");
diff --git a/src/gtkext/gtkdockstation.c b/src/gtkext/gtkdockstation.c
index a742c07..157b286 100644
--- a/src/gtkext/gtkdockstation.c
+++ b/src/gtkext/gtkdockstation.c
@@ -196,12 +196,12 @@ GtkWidget *gtk_dock_station_new(void)
static gboolean gtk_dock_station_switch_panel(GtkNotebook *notebook, gpointer *page, guint index, gpointer data)
{
GtkWidget *widget; /* Panneau concerné */
- char *caption; /* Texte à redonner */
+ char *str; /* Texte à redonner */
widget = gtk_notebook_get_nth_page(notebook, index);
- caption = g_object_get_data(G_OBJECT(widget), "title");
+ str = g_object_get_data(G_OBJECT(widget), "title");
- gtk_dock_panel_update_title(GTK_DOCK_STATION(data), widget, caption);
+ gtk_dock_panel_update_title(GTK_DOCK_STATION(data), widget, str);
g_signal_emit_by_name(GTK_DOCK_STATION(data), "switch-widget", widget);
@@ -215,6 +215,7 @@ static gboolean gtk_dock_station_switch_panel(GtkNotebook *notebook, gpointer *p
* Paramètres : station = plateforme GTK à compléter. *
* widget = nouvel élément à intégrer. *
* caption = intitulé court à afficher sur les onglets. *
+* desc = intitulé long pour le titre et la description. *
* *
* Description : Ajoute un paquet d'informations à l'affichage centralisé. *
* *
@@ -224,13 +225,13 @@ static gboolean gtk_dock_station_switch_panel(GtkNotebook *notebook, gpointer *p
* *
******************************************************************************/
-void gtk_dock_panel_add_widget(GtkDockStation *station, GtkWidget *widget, const char *caption)
+void gtk_dock_panel_add_widget(GtkDockStation *station, GtkWidget *widget, const char *caption, const char *desc)
{
size_t max; /* Taille maximale des titres */
char *str; /* Titre des prochaines fois */
GtkWidget *label; /* Etiquette d'onglet */
- max = 3; // TODO : config dans un .so pour Python // get_integer_config_value(get_main_configuration(), MPT_ELLIPSIS_TAB);
+ max = 35; // TODO : config dans un .so pour Python // get_integer_config_value(get_main_configuration(), MPT_ELLIPSIS_TAB);
str = ellipsis(strdup(caption), max);
label = qck_create_label(NULL, NULL, str);
@@ -240,7 +241,7 @@ void gtk_dock_panel_add_widget(GtkDockStation *station, GtkWidget *widget, const
G_CALLBACK(gtk_dock_station_switch_panel), station);
gtk_notebook_insert_page(station->notebook, widget, label, -1);
- gtk_widget_set_tooltip_text(label, caption);
+ gtk_widget_set_tooltip_text(label, desc);
g_signal_connect(station->notebook, "switch-page",
G_CALLBACK(gtk_dock_station_switch_panel), station);
@@ -249,10 +250,10 @@ void gtk_dock_panel_add_widget(GtkDockStation *station, GtkWidget *widget, const
str = g_object_get_data(G_OBJECT(widget), "title");
if (str != NULL) free(str);
- max = 3; // TODO : config dans un .so pour Python // get_integer_config_value(get_main_configuration(), MPT_ELLIPSIS_HEADER);
- g_object_set_data(G_OBJECT(widget), "title", ellipsis(strdup(caption), max));
+ max = 54; // TODO : config dans un .so pour Python // get_integer_config_value(get_main_configuration(), MPT_ELLIPSIS_HEADER);
+ g_object_set_data(G_OBJECT(widget), "title", ellipsis(strdup(desc), max));
- gtk_dock_panel_update_title(station, widget, caption);
+ gtk_dock_panel_update_title(station, widget, desc);
gtk_notebook_set_current_page(station->notebook, -1);
diff --git a/src/gtkext/gtkdockstation.h b/src/gtkext/gtkdockstation.h
index 399f277..7cc2263 100644
--- a/src/gtkext/gtkdockstation.h
+++ b/src/gtkext/gtkdockstation.h
@@ -76,7 +76,7 @@ GType gtk_dock_station_get_type(void);
GtkWidget *gtk_dock_station_new(void);
/* Ajoute un paquet d'informations à l'affichage centralisé. */
-void gtk_dock_panel_add_widget(GtkDockStation *, GtkWidget *, const char *);
+void gtk_dock_panel_add_widget(GtkDockStation *, GtkWidget *, const char *, const char *);
/* Change le contenu de l'onglet courant uniquement. */
void gtk_dock_panel_change_active_widget(GtkDockStation *, GtkWidget *);
diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c
index 56557f9..3c85cd8 100644
--- a/src/gui/menus/project.c
+++ b/src/gui/menus/project.c
@@ -147,7 +147,7 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project,
for (i = 0; i < count; i++)
{
- desc = g_loaded_binary_get_filename(binaries[i], true);
+ desc = g_loaded_binary_get_name(binaries[i], true);
submenuitem = qck_create_menu_item(NULL, NULL, desc,
G_CALLBACK(mcb_project_remove_binary), project);
diff --git a/src/gui/panels/panel.c b/src/gui/panels/panel.c
index 16f1532..9a1e1c2 100644
--- a/src/gui/panels/panel.c
+++ b/src/gui/panels/panel.c
@@ -428,7 +428,7 @@ static panel_node *create_simple_panel_node_for_item(GPanelItem *item, const cha
editem = G_EDITOR_ITEM(item);
gtk_dock_panel_add_widget(GTK_DOCK_STATION(station),
- editem->widget, editem->name);
+ editem->widget, editem->name, item->lname);
return result;
@@ -685,7 +685,8 @@ static void insert_item_as_panel_node(GPanelItem *item, panel_node *node, const
if (strcmp(node->path, path) == 0)
gtk_dock_panel_add_widget(GTK_DOCK_STATION(node->station),
G_EDITOR_ITEM(item)->widget,
- G_EDITOR_ITEM(item)->name);
+ G_EDITOR_ITEM(item)->name,
+ item->lname);
/* On ne peut aller plus loin, on doit diviser... */
else
diff --git a/src/project.c b/src/project.c
index 9c4c636..bc3ec66 100644
--- a/src/project.c
+++ b/src/project.c
@@ -352,7 +352,8 @@ size_t g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *bina
GtkWidget *view; /* Affichage du binaire */
BinaryDisplayType type; /* Options d'affichage */
GtkWidget *scroll; /* Surface d'exposition */
- const char *title; /* Titre associé au binaire */
+ const char *name; /* Titre associé au binaire */
+ const char *lname; /* Description du binaire */
loaded = (loaded_binary *)calloc(1, sizeof(loaded_binary));
@@ -400,9 +401,10 @@ size_t g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *bina
/* Support graphique final */
scroll = loaded->scrollwindows[BVW_BLOCK];
- title = g_loaded_binary_get_filename(binary, false);
+ name = g_loaded_binary_get_name(binary, false);
+ lname = g_loaded_binary_get_name(binary, true);
- loaded->item = g_panel_item_new(project->ref, title, title, scroll, "M");
+ loaded->item = g_panel_item_new(project->ref, name, lname, scroll, "M");
/* Enregistrement dans le projet */