diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binary.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 396dbe0..a24c3d3 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -566,10 +566,10 @@ void disassemble_openida_binary(openida_binary *binary) uint64_t routine_offset; /* Point de départ de routine */ char *routine_desc; /* Prototype d'une routine */ + GPluginModule **pglist; /* Liste de greffons */ + size_t pgcount; /* Taille de cette liste */ - GPluginModule *disass; /* Eventuel greffon de désass. */ - binary->lines = build_binary_prologue(binary->filename, binary->bin_data, binary->bin_length); @@ -579,56 +579,46 @@ void disassemble_openida_binary(openida_binary *binary) + parts = /* !!! */get_elf_default_code_parts(binary->format, &parts_count); + qsort(parts, parts_count, sizeof(bin_part *), compare_bin_parts); - disass = get_one_plugin_for_action(PGA_DISASSEMBLE); - - if (0 && disass != NULL) - binary->lines = g_plugin_module_disassemble_binary_parts(disass, binary); + printf("PARTS COUNT :: %d\n", parts_count); - else + for (i = 0; i < parts_count; i++) { - parts = /* !!! */get_elf_default_code_parts(binary->format, &parts_count); - qsort(parts, parts_count, sizeof(bin_part *), compare_bin_parts); - - printf("PARTS COUNT :: %d\n", parts_count); - - for (i = 0; i < parts_count; i++) - { - get_bin_part_values(parts[i], &pos, &len, &base); + get_bin_part_values(parts[i], &pos, &len, &base); - /* Décodage des instructions */ + /* Décodage des instructions */ - start = pos; - pos = 0; - - while (pos < len) - { - addr = base + pos; + start = pos; + pos = 0; + while (pos < len) + { + addr = base + pos; - instr = g_arch_processor_decode_instruction(binary->proc, &binary->bin_data[start], &pos, len, start, addr); - line = g_code_line_new(addr, instr, binary->options); - g_rendering_line_add_to_lines(&binary->lines, line); + instr = g_arch_processor_decode_instruction(binary->proc, &binary->bin_data[start], &pos, len, start, addr); - } + line = g_code_line_new(addr, instr, binary->options); + g_rendering_line_add_to_lines(&binary->lines, line); - /* Ajout des prototypes de fonctions */ + } - for (k = 0; k < routines_count; k++) - { - routine_offset = g_binary_routine_get_address(routines[k]); + /* Ajout des prototypes de fonctions */ - if (!(base <= routine_offset && routine_offset < (base + len))) continue; + for (k = 0; k < routines_count; k++) + { + routine_offset = g_binary_routine_get_address(routines[k]); - routine_desc = g_binary_routine_to_string(routines[k]); + if (!(base <= routine_offset && routine_offset < (base + len))) continue; - line = g_comment_line_new(routine_offset, routine_desc, binary->options); - g_rendering_line_insert_into_lines(&binary->lines, line, true); + routine_desc = g_binary_routine_to_string(routines[k]); - free(routine_desc); + line = g_comment_line_new(routine_offset, routine_desc, binary->options); + g_rendering_line_insert_into_lines(&binary->lines, line, true); - } + free(routine_desc); } @@ -640,8 +630,18 @@ void disassemble_openida_binary(openida_binary *binary) line = g_rendering_line_find_by_address(binary->lines, NULL, get_exe_entry_point(binary->format)); if (line != NULL) g_rendering_line_add_flag(line, RLF_ENTRY_POINT); + /* Action post-désassemblage */ + pglist = get_all_plugins_for_action(PGA_CODE_PROCESS, &pgcount); + if (pgcount > 0) + { + for (i = 0; i < pgcount; i++) + g_plugin_module_execute_action_on_binary(pglist[i], binary, PGA_CODE_PROCESS); + + free(pglist); + + } } |