|
|
@ -43,18 +43,22 @@ int __cdecl main( int argc, const char *argv[] )
|
|
|
|
|
|
|
|
|
|
|
|
if ( parser.exists( "bin" ) && parser.exists( "vmentry" ) )
|
|
|
|
if ( parser.exists( "bin" ) && parser.exists( "vmentry" ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if ( !std::filesystem::exists( parser.get< std::string >( "bin" ) ) )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::printf( "> path to protected file is invalid... check your cli args...\n" );
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const auto module_base = reinterpret_cast< std::uintptr_t >(
|
|
|
|
const auto module_base = reinterpret_cast< std::uintptr_t >(
|
|
|
|
LoadLibraryExA( parser.get< std::string >( "bin" ).c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES ) );
|
|
|
|
LoadLibraryExA( parser.get< std::string >( "bin" ).c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES ) );
|
|
|
|
|
|
|
|
|
|
|
|
const auto vm_entry_rva = std::strtoull( parser.get< std::string >( "vmentry" ).c_str(), nullptr, 16 );
|
|
|
|
const auto vm_entry_rva = std::strtoull( parser.get< std::string >( "vmentry" ).c_str(), nullptr, 16 );
|
|
|
|
|
|
|
|
|
|
|
|
const auto image_base = umtils->image_base( parser.get< std::string >( "bin" ).c_str() );
|
|
|
|
const auto image_base = umtils->image_base( parser.get< std::string >( "bin" ).c_str() );
|
|
|
|
|
|
|
|
|
|
|
|
const auto image_size = NT_HEADER( module_base )->OptionalHeader.SizeOfImage;
|
|
|
|
const auto image_size = NT_HEADER( module_base )->OptionalHeader.SizeOfImage;
|
|
|
|
|
|
|
|
|
|
|
|
std::printf( "> module base = 0x%p, image base = 0x%p, image size = 0x%p\n", module_base, image_base,
|
|
|
|
std::printf( "> module base = 0x%p, image base = 0x%p, image size = 0x%p\n", module_base, image_base,
|
|
|
|
image_size );
|
|
|
|
image_size );
|
|
|
|
|
|
|
|
|
|
|
|
vm::ctx_t vmctx( module_base, image_base, image_size, vm_entry_rva );
|
|
|
|
vm::ctx_t vmctx( module_base, image_base, image_size, vm_entry_rva );
|
|
|
|
|
|
|
|
|
|
|
|
if ( !vmctx.init() )
|
|
|
|
if ( !vmctx.init() )
|
|
|
|