diff options
Diffstat (limited to 'plugins/ropgadgets')
-rw-r--r-- | plugins/ropgadgets/finder.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/plugins/ropgadgets/finder.c b/plugins/ropgadgets/finder.c index 6a2283c..98871b5 100644 --- a/plugins/ropgadgets/finder.c +++ b/plugins/ropgadgets/finder.c @@ -323,6 +323,7 @@ found_rop_list *list_all_gadgets(GExeFormat *format, unsigned int max_depth, upd found_rop_list *result; /* Liste de listes à renvoyer */ const char *target; /* Sous-traitance requise */ search_domain domain; /* Outils pour la recherche */ + GBinPortion *portions; /* Couche première de portions */ GProcContext **contexts; /* Contextes pour recherches */ char **names; /* Désignations humaines liées */ size_t i; /* Boucle de parcours */ @@ -337,7 +338,35 @@ found_rop_list *list_all_gadgets(GExeFormat *format, unsigned int max_depth, upd target = g_exe_format_get_target_machine(format); domain.proc = get_arch_processor_for_type(target); - domain.exe_ranges = g_exe_format_get_x_ranges(format, &domain.exe_count); + bool collect_x_ranges(GBinPortion *portion, GBinPortion *parent, BinaryPortionVisit visit, void *unused) + { + const mrange_t *range; + + if (visit == BPV_SHOW) + { + if (g_binary_portion_get_rights(portion) & PAC_EXEC) + { + range = g_binary_portion_get_range(portion); + + domain.exe_ranges = (mrange_t *)realloc(domain.exe_ranges, ++domain.exe_count * sizeof(mrange_t)); + copy_mrange(&domain.exe_ranges[domain.exe_count - 1], range); + + } + + } + + return true; + + } + + domain.exe_ranges = NULL; + domain.exe_count = 0; + + portions = g_exe_format_get_portions(format); + + g_binary_portion_visit(portions, (visit_portion_fc)collect_x_ranges, NULL); + + g_object_unref(G_OBJECT(portions)); /* Récupération des différents contextes */ |