|
|
|
@ -213,8 +213,9 @@ namespace theo
|
|
|
|
|
// these symbols are generated by llvm-obfuscator as "x" and "y"...
|
|
|
|
|
else if (reloc.raw_symbol.StorageClass == IMAGE_SYM_CLASS_EXTERNAL && reloc.raw_symbol.Value)
|
|
|
|
|
{
|
|
|
|
|
const auto zero_me = alloc(reloc.raw_symbol.Value);
|
|
|
|
|
const auto zero_me = alloc(reloc.raw_symbol.Value, PAGE_READWRITE);
|
|
|
|
|
const auto zero_size = malloc(reloc.raw_symbol.Value);
|
|
|
|
|
|
|
|
|
|
memset(zero_size, NULL, reloc.raw_symbol.Value);
|
|
|
|
|
mcopy(zero_me, zero_size, reloc.raw_symbol.Value);
|
|
|
|
|
free(zero_size);
|
|
|
|
@ -383,7 +384,7 @@ namespace theo
|
|
|
|
|
// these symbols are generated by llvm-obfuscator as "x" and "y"...
|
|
|
|
|
else if (reloc.raw_symbol.StorageClass == IMAGE_SYM_CLASS_EXTERNAL && reloc.raw_symbol.Value)
|
|
|
|
|
{
|
|
|
|
|
const auto zero_me = alloc(reloc.raw_symbol.Value);
|
|
|
|
|
const auto zero_me = alloc(reloc.raw_symbol.Value, PAGE_READWRITE);
|
|
|
|
|
const auto zero_size = malloc(reloc.raw_symbol.Value);
|
|
|
|
|
memset(zero_size, NULL, reloc.raw_symbol.Value);
|
|
|
|
|
mcopy(zero_me, zero_size, reloc.raw_symbol.Value);
|
|
|
|
@ -527,7 +528,7 @@ namespace theo
|
|
|
|
|
|
|
|
|
|
mapped_symbols[new_symbol] =
|
|
|
|
|
reinterpret_cast<std::uintptr_t>(
|
|
|
|
|
alloc(new_gadget->get_size()));
|
|
|
|
|
alloc(new_gadget->get_size(), PAGE_EXECUTE_READWRITE));
|
|
|
|
|
|
|
|
|
|
obfuscated_gadgets[mapped_symbols[new_symbol]] = new_gadget;
|
|
|
|
|
DBG_PRINT("\t\t> %s allocated = 0x%p, size = %d\n", new_symbol.c_str(),
|
|
|
|
@ -565,7 +566,7 @@ namespace theo
|
|
|
|
|
if (symbol.type == IMAGE_SYM_FUNCTION)
|
|
|
|
|
{
|
|
|
|
|
mapped_symbols[symbol.symbol_name] =
|
|
|
|
|
reinterpret_cast<std::uintptr_t>(alloc(symbol.size));
|
|
|
|
|
reinterpret_cast<std::uintptr_t>(alloc(symbol.size, PAGE_EXECUTE_READWRITE));
|
|
|
|
|
|
|
|
|
|
DBG_PRINT("\t> %s allocated at = 0x%p, size = %d\n",
|
|
|
|
|
symbol.symbol_name.c_str(), mapped_symbols[symbol.symbol_name], symbol.size);
|
|
|
|
@ -584,7 +585,7 @@ namespace theo
|
|
|
|
|
{
|
|
|
|
|
mapped_symbols[data_section_sym] =
|
|
|
|
|
reinterpret_cast<std::uintptr_t>(alloc(
|
|
|
|
|
section_headers[symbol.section_number - 1].SizeOfRawData));
|
|
|
|
|
section_headers[symbol.section_number - 1].SizeOfRawData, PAGE_READWRITE));
|
|
|
|
|
|
|
|
|
|
DBG_PRINT("\t> section %s allocated at = 0x%p, size = %d\n",
|
|
|
|
|
data_section_sym.c_str(),
|
|
|
|
@ -638,7 +639,7 @@ namespace theo
|
|
|
|
|
{
|
|
|
|
|
mapped_symbols[data_section_sym] =
|
|
|
|
|
reinterpret_cast<std::uintptr_t>(alloc(
|
|
|
|
|
section_headers[idx].SizeOfRawData));
|
|
|
|
|
section_headers[idx].SizeOfRawData, PAGE_READWRITE));
|
|
|
|
|
|
|
|
|
|
DBG_PRINT("\t> section %s allocated at = 0x%p, size = %d\n",
|
|
|
|
|
data_section_sym.c_str(),
|
|
|
|
|