parent
78033b5ba2
commit
05748c67be
@ -1,31 +1,33 @@
|
|||||||
|
#include <Zydis/Zydis.h>
|
||||||
|
|
||||||
#include <vmprofiler.hpp>
|
#include <vmprofiler.hpp>
|
||||||
|
|
||||||
namespace vm
|
namespace vm {
|
||||||
{
|
ctx_t::ctx_t(std::uintptr_t module_base, std::uintptr_t image_base,
|
||||||
ctx_t::ctx_t( std::uintptr_t module_base, std::uintptr_t image_base, std::uintptr_t image_size,
|
std::uintptr_t image_size, std::uintptr_t vm_entry_rva)
|
||||||
std::uintptr_t vm_entry_rva )
|
: module_base(module_base),
|
||||||
: module_base( module_base ), image_base( image_base ), image_size( image_size ), vm_entry_rva( vm_entry_rva )
|
image_base(image_base),
|
||||||
{
|
image_size(image_size),
|
||||||
}
|
vm_entry_rva(vm_entry_rva) {}
|
||||||
|
|
||||||
bool ctx_t::init()
|
bool ctx_t::init() {
|
||||||
{
|
vm::util::init();
|
||||||
if ( !vm::util::flatten( vm_entry, vm_entry_rva + module_base ) )
|
if (!vm::util::flatten(vm_entry, vm_entry_rva + module_base)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
vm::util::deobfuscate( vm_entry );
|
vm::util::deobfuscate(vm_entry);
|
||||||
if ( !vm::calc_jmp::get( vm_entry, calc_jmp ) )
|
if (!vm::calc_jmp::get(vm_entry, calc_jmp)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( auto vm_handler_table = vm::handler::table::get( vm_entry );
|
if (auto vm_handler_table = vm::handler::table::get(vm_entry);
|
||||||
!vm::handler::get_all( module_base, image_base, vm_entry, vm_handler_table, vm_handlers ) )
|
!vm::handler::get_all(module_base, image_base, vm_entry, vm_handler_table,
|
||||||
|
vm_handlers))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( auto advancement = vm::calc_jmp::get_advancement( calc_jmp ); advancement.has_value() )
|
if (auto advancement = vm::calc_jmp::get_advancement(calc_jmp);
|
||||||
|
advancement.has_value())
|
||||||
exec_type = advancement.value();
|
exec_type = advancement.value();
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // namespace vm
|
} // namespace vm
|
Loading…
Reference in new issue