James 3 years ago
parent 07d4738ec0
commit 273401b754

@ -148,6 +148,8 @@ bool obf_create_groups(pobfuscator_t obf, int32_t group_size)
abs_addr->raw_data_size = 8; abs_addr->raw_data_size = 8;
abs_addr->group = i; abs_addr->group = i;
cur_group->size_in_bytes += END_OF_GROUP_GAGT_SIZE;
pcode_link_t real_next = cur_group->end->next; pcode_link_t real_next = cur_group->end->next;
cur_group->end->next = gadget; cur_group->end->next = gadget;
gadget->next = abs_addr; gadget->next = abs_addr;
@ -273,17 +275,6 @@ bool obf_resolve_abs_addresses(pobfuscator_t obf)
return true; return true;
} }
size_t obf_get_group_size(pobfuscator_t obf, int group_id)
{
if (group_id < obf->groups.size())
return obf->groups[group_id].size_in_bytes;
}
void obf_copy_group_to_buffer(pobfuscator_t obf, void* buffer, int group_id)
{
}
bool obf_gen_all_labels(pobfuscator_t obf) bool obf_gen_all_labels(pobfuscator_t obf)
{ {
for (pcode_link_t t = obf->code_start->next; t; t = t->next) for (pcode_link_t t = obf->code_start->next; t; t = t->next)
@ -354,6 +345,16 @@ bool obf_gen_label(pobfuscator_t obf, pcode_link_t jmp, int32_t delta)
return true; return true;
} }
bool obf_allocate_group_buffers(pobfuscator_t obf, FnAllocateMem AllocMem)
{
}
bool obf_copy_groups_into_buffers(pobfuscator_t obf, FnMemCopy MemCopy)
{
}
#include <Windows.h> #include <Windows.h>
void obf_dbg_print_code(pobfuscator_t obf) void obf_dbg_print_code(pobfuscator_t obf)
@ -362,8 +363,6 @@ void obf_dbg_print_code(pobfuscator_t obf)
if (!StdHandle) if (!StdHandle)
return; return;
for (pcode_link_t t = obf->code_start->next; t; t = t->next) for (pcode_link_t t = obf->code_start->next; t; t = t->next)
{ {
if (t->group % 2) if (t->group % 2)

@ -52,7 +52,9 @@ typedef struct _obfuscator_t
xed_address_width_enum_t addr_width; xed_address_width_enum_t addr_width;
}obfuscator_t, *pobfuscator_t; }obfuscator_t, *pobfuscator_t;
typedef void* (*FnAllocateMem)(unsigned long size); typedef void* (*FnAllocateMem)(uint32_t size);
typedef void (*FnMemCopy)(void* dest, void* src, uint32_t size);
//snickers //snickers
void obf_one_time_please(); void obf_one_time_please();
@ -69,18 +71,17 @@ void obf_replace_rel_jmps(pobfuscator_t obf);
//replaces address in the abs jmp stub with the right address of the given label. //replaces address in the abs jmp stub with the right address of the given label.
bool obf_resolve_abs_addresses(pobfuscator_t obf); bool obf_resolve_abs_addresses(pobfuscator_t obf);
//return number of bytes needed to store given group
size_t obf_get_group_size(pobfuscator_t obf, int group_id);
//copy group to whever u want it to go
void obf_copy_group_to_buffer(pobfuscator_t obf, void* buffer, int group_id);
//generate all the labels after loaded from buffa //generate all the labels after loaded from buffa
bool obf_gen_all_labels(pobfuscator_t obf); bool obf_gen_all_labels(pobfuscator_t obf);
//walk backwards or forwards until placing label //walk backwards or forwards until placing label
bool obf_gen_label(pobfuscator_t obf, pcode_link_t start, int32_t delta); bool obf_gen_label(pobfuscator_t obf, pcode_link_t start, int32_t delta);
//allocate buffers for all groups
bool obf_allocate_group_buffers(pobfuscator_t obf, FnAllocateMem AllocMem);
//copy all instructions from each group into allocated buffers
bool obf_copy_groups_into_buffers(pobfuscator_t obf, FnMemCopy MemCopy);
void obf_dbg_print_code(pobfuscator_t obf); void obf_dbg_print_code(pobfuscator_t obf);

Loading…
Cancel
Save