diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/androhelpers/androhelpers.c | 7 | ||||
-rw-r--r-- | plugins/androhelpers/try_n_catch.c | 48 | ||||
-rw-r--r-- | plugins/androhelpers/try_n_catch.h | 2 |
3 files changed, 31 insertions, 26 deletions
diff --git a/plugins/androhelpers/androhelpers.c b/plugins/androhelpers/androhelpers.c index 95714fd..f7360f8 100644 --- a/plugins/androhelpers/androhelpers.c +++ b/plugins/androhelpers/androhelpers.c @@ -67,7 +67,7 @@ PluginAction get_plugin_action(const GPluginModule *plugin) { PluginAction result; /* Combinaison à retourner */ - result = PGA_BINARY_DISASSEMBLED | PGA_BINARY_PRINTED; + result = PGA_BINARY_DISASSEMBLED | PGA_BINARY_LINKED | PGA_BINARY_PRINTED; return result; @@ -97,8 +97,11 @@ bool execute_action_on_binary(GPluginModule *plugin, GLoadedBinary *binary, Plug if (action == PGA_BINARY_DISASSEMBLED) result &= replace_parameters(binary); + else if (action == PGA_BINARY_LINKED) + result &= process_exception_handlers(binary, true); + else if (action == PGA_BINARY_PRINTED) - result &= process_exception_handlers(binary); + result &= process_exception_handlers(binary, false); return result; diff --git a/plugins/androhelpers/try_n_catch.c b/plugins/androhelpers/try_n_catch.c index 27c7959..d2ab4a9 100644 --- a/plugins/androhelpers/try_n_catch.c +++ b/plugins/androhelpers/try_n_catch.c @@ -58,7 +58,7 @@ static void mark_exception_handlers(const GLoadedBinary *, uleb128_t, caught_exc static caught_exception **build_all_destinations_list(const GLoadedBinary *, const GBinRoutine *, const encoded_catch_handler_list *, size_t **); /* Recherche et met en avant tous les gestionnaires d'exception. */ -static void look_for_exception_handlers(const GLoadedBinary *, const GDexFormat *, GDexMethod *); +static void look_for_exception_handlers(const GLoadedBinary *, const GDexFormat *, GDexMethod *, bool); @@ -127,7 +127,7 @@ static void attach_caught_code(const GLoadedBinary *binary, const GBinRoutine *r first = g_arch_instruction_find_by_address(instrs, start, true); next = g_arch_instruction_find_by_address(instrs, end, true); - if (start == NULL || next == NULL) + if (first == NULL || next == NULL) return; /* Si des détachements sont nécessaires... */ @@ -312,6 +312,7 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar * Paramètres : binary = représentation binaire à traiter. * * format = format du binaire Dex. * * method = méthode à analyser. * +* link = édition de liens ou impression de commentaires ? * * * * Description : Recherche et met en avant tous les gestionnaires d'exception.* * * @@ -321,7 +322,7 @@ static caught_exception **build_all_destinations_list(const GLoadedBinary *binar * * ******************************************************************************/ -static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexFormat *format, GDexMethod *method) +static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexFormat *format, GDexMethod *method, bool link) { const code_item *body; /* Description du corps */ GBinRoutine *routine; /* Abstraction globale */ @@ -343,29 +344,29 @@ static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexF hlist = body->handlers; handlers = build_all_destinations_list(binary, routine, hlist, &count); - /* Pour chaque zone couverte... */ - - for (i = 0; i < body->tries_size; i++) - { - try = &body->tries[i]; - - if (!check_covered_area(try, routine)) - continue; + if (link) + /* Pour chaque zone couverte... */ + for (i = 0; i < body->tries_size; i++) + { + try = &body->tries[i]; - for (index = 0; index < hlist->size; index++) - if (try->handler_off == hlist->list[index].offset) - break; + if (!check_covered_area(try, routine)) + continue; - if (index == hlist->size) - continue; + for (index = 0; index < hlist->size; index++) + if (try->handler_off == hlist->list[index].offset) + break; - attach_caught_code(binary, routine, try, handlers[index], count[index]); + if (index == hlist->size) + continue; - } + attach_caught_code(binary, routine, try, handlers[index], count[index]); - /* Ajout des précisions */ + } - mark_exception_handlers(binary, hlist->size, handlers, count); + else + /* Ajout des précisions */ + mark_exception_handlers(binary, hlist->size, handlers, count); /* Libération de la mémoire utilisée */ @@ -388,6 +389,7 @@ static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexF /****************************************************************************** * * * Paramètres : binary = représentation binaire à traiter. * +* link = édition de liens ou impression de commentaires ? * * * * Description : Traite tous les gestionnaires d'exception trouvés. * * * @@ -397,7 +399,7 @@ static void look_for_exception_handlers(const GLoadedBinary *binary, const GDexF * * ******************************************************************************/ -bool process_exception_handlers(GLoadedBinary *binary) +bool process_exception_handlers(GLoadedBinary *binary, bool link) { GDexFormat *format; /* Format du binaire chargé */ size_t cls_count; /* Nombre de classes trouvées */ @@ -421,14 +423,14 @@ bool process_exception_handlers(GLoadedBinary *binary) for (j = 0; j < meth_count; j++) { method = g_dex_class_get_method(class, false, j); - look_for_exception_handlers(binary, format, method); + look_for_exception_handlers(binary, format, method, link); } meth_count = g_dex_class_count_methods(class, true); for (j = 0; j < meth_count; j++) { method = g_dex_class_get_method(class, true, j); - look_for_exception_handlers(binary, format, method); + look_for_exception_handlers(binary, format, method, link); } } diff --git a/plugins/androhelpers/try_n_catch.h b/plugins/androhelpers/try_n_catch.h index 5ac4ad5..31a9e5e 100644 --- a/plugins/androhelpers/try_n_catch.h +++ b/plugins/androhelpers/try_n_catch.h @@ -30,7 +30,7 @@ /* Traite tous les gestionnaires d'exception trouvés. */ -bool process_exception_handlers(GLoadedBinary *); +bool process_exception_handlers(GLoadedBinary *, bool); |