From abc912f8500312c888832ff521d3dd17d8b2c613 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 10 Feb 2016 16:24:59 +0100 Subject: Displayed the name of the area containing a string, if any. --- ChangeLog | 9 +++++++++ src/analysis/disass/fetch.c | 2 +- src/gui/panels/strings.c | 23 ++++++++++++++++++++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce0717f..fed398e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 16-02-10 Cyrille Bagard + * src/analysis/disass/fetch.c: + Do not allow half defined locations before running the disassembling + process. + + * src/gui/panels/strings.c: + Display the name of the area containing a string, if any. + +16-02-10 Cyrille Bagard + * src/arch/dalvik/Makefile.am: Add the new 'helpers.h' file to libarchdalvik_la_SOURCES. diff --git a/src/analysis/disass/fetch.c b/src/analysis/disass/fetch.c index e9098eb..4813111 100644 --- a/src/analysis/disass/fetch.c +++ b/src/analysis/disass/fetch.c @@ -287,7 +287,7 @@ static void g_delayed_fetching_process(GDelayedFetching *fetching, GtkExtStatusB mem_area_v2 *area; /* Zone trouvée à traiter */ if (!g_exe_format_translate_address_into_vmpa(fetching->format, fetching->virt, &addr)) - init_vmpa(&addr, VMPA_NO_PHYSICAL, fetching->virt); + return/*init_vmpa(&addr, VMPA_NO_PHYSICAL, fetching->virt)*/; area = find_memory_area_by_addr_v2(fetching->areas, fetching->count, &addr); diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index a6ff7ca..abbf7ed 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -70,6 +70,7 @@ typedef enum _StringsColumn STC_PHYSICAL, /* Adresse phyisque */ STC_VIRTUAL, /* Adresse virtuelle */ + STC_AREA, /* Zone de localisation */ STC_NAME, /* Désignation humaine */ STC_VALUE, /* Chaîne de caractères */ @@ -229,7 +230,7 @@ static void g_strings_panel_init(GStringsPanel *panel) /* Partie chaînes */ store = gtk_tree_store_new(STC_COUNT, G_TYPE_OBJECT, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); panel->treeview = GTK_TREE_VIEW(treeview); @@ -263,6 +264,14 @@ static void g_strings_panel_init(GStringsPanel *panel) gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); renderer = gtk_cell_renderer_text_new(); + g_object_set(renderer, "xpad", 16, NULL); + column = gtk_tree_view_column_new_with_attributes(_("Area"), renderer, + "text", STC_AREA, + NULL); + gtk_tree_view_column_set_sort_column_id(column, STC_AREA); + gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + + renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "editable", TRUE, NULL); g_signal_connect(renderer, "edited", G_CALLBACK(on_string_value_edited), store); column = gtk_tree_view_column_new_with_attributes(_("Name"), renderer, @@ -288,6 +297,9 @@ static void g_strings_panel_init(GStringsPanel *panel) gtk_tree_sortable_set_sort_func(sortable, STC_VIRTUAL, compare_strings_list_columns, GINT_TO_POINTER(STC_VIRTUAL), NULL); + gtk_tree_sortable_set_sort_func(sortable, STC_AREA, compare_strings_list_columns, + GINT_TO_POINTER(STC_AREA), NULL); + gtk_tree_sortable_set_sort_func(sortable, STC_NAME, compare_strings_list_columns, GINT_TO_POINTER(STC_NAME), NULL); @@ -460,6 +472,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin GArchProcessor *proc; /* Architecture du binaire */ MemoryDataSize msize; /* Taille par défaut */ GExeFormat *format; /* Format de travail */ + GPortionLayer *layer; /* Couche première de portions */ GBinContent *content; /* Contenu binaire en mémoire */ size_t count; /* Nombre des chaînes */ GBinSymbol **symbols; /* Liste des chaînes trouvées */ @@ -468,6 +481,8 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin const vmpa2t *addr; /* Adressse liée à la chaîne */ VMPA_BUFFER(phys); /* Position physique */ VMPA_BUFFER(virt); /* Adresse virtuelle */ + GBinPortion *portion; /* Zone mémoire d'appartenance */ + const char *area; /* Description de la zone */ const char *label; /* Etiquette liée au symbole */ vmpa2t pos; /* Tête de lecture modifiable */ char *text; /* Version imprimable du texte */ @@ -497,6 +512,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin g_object_unref(G_OBJECT(proc)); format = g_loaded_binary_get_format(binary); + layer = g_exe_format_get_main_layer(format); content = g_binary_format_get_content(G_BIN_FORMAT(format)); symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count); @@ -511,6 +527,9 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin vmpa2_phys_to_string(addr, msize, phys, NULL); vmpa2_virt_to_string(addr, msize, virt, NULL); + portion = g_portion_layer_find_portion_at_addr(layer, addr, (GdkRectangle []) { }); + area = g_binary_portion_get_desc(portion); + label = g_binary_symbol_get_label(symbols[i]); text = (char *)calloc(get_mrange_length(range) + 1, sizeof(char)); @@ -540,6 +559,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin STC_STRING, symbols[i], STC_PHYSICAL, phys, STC_VIRTUAL, virt, + STC_AREA, area, STC_NAME, label, STC_VALUE, text, -1); @@ -548,6 +568,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin } + g_object_unref(G_OBJECT(layer)); g_object_unref(G_OBJECT(content)); } -- cgit v0.11.2-87-g4458