You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB

3 years ago
//#include "Obfuscator.h"
//
//#include "xed/xed-interface.h"
//
//int main()
//{
// xed_decoded_inst_t instruction;
//
// return 1;
//}
//#pragma comment(lib, "xed.lib")
#include "Obfuscator.h"
3 years ago
void* alloc_mem(uint32_t size)
{
return malloc(size);
}
void mem_copy(void* src, void* dest, uint32_t size)
{
memcpy(src, dest, size);
}
3 years ago
int main(int argc, char** argv)
{
3 years ago
unsigned char buffer[] = { 0x48, 0x33, 0xC0, 0x48, 0x33, 0xC0, 0xEB, 0x08, 0x48, 0x33, 0xC0, 0x7E, 0x03, 0x48, 0x33, 0xC0, 0x48, 0x33, 0xC0, 0x48, 0x33, 0xC0, 0x48, 0x33, 0xC0, 0xEB, 0x08, 0x48, 0x33, 0xC0, 0x7E, 0x03, 0x48, 0x33, 0xC0, 0x48, 0x33, 0xC0 };//{ 0x48, 0x33, 0xC0, 0x48, 0x33, 0xC0, 0xEB, 0xFB, 0x48, 0x33, 0xC0, 0x7E, 0xF6, 0xC3 };
3 years ago
unsigned int buffer_size = sizeof(buffer);
obfuscator_t obf;
obf_one_time_please();
obf_init_from_buffer(&obf, buffer, buffer_size);
obf_gen_all_labels(&obf);
3 years ago
obf_replace_rel_jmps(&obf);
3 years ago
obf_create_groups(&obf, 10);
3 years ago
obf_dbg_print_code(&obf);
obf_allocate_group_buffers(&obf, alloc_mem);
3 years ago
obf_resolve_abs_addresses(&obf);
3 years ago
obf_copy_groups_into_buffers(&obf, mem_copy);
printf("\n\n");
3 years ago
3 years ago
obf_print_byte_array((void*)obf.groups[0].base_address, obf.groups[0].size_in_bytes);
3 years ago
3 years ago
system("pause");
}