summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-07-19 22:28:13 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-07-19 22:28:13 (GMT)
commit59bda76b1a76d796a42ee46b9da7041dbef57253 (patch)
tree36f7d6eaa7847016b99431b1b489c6a1fdbaf33b /src/analysis
parent3a9fe39c6a8923f45e7c96d80b0bfe52b8686ff9 (diff)
Encapsulated all recognized variables in the stack using a new plugin (need to be continued).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@99 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c72
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);
+
+ }
}