
ユーザーモードからx86-64ページングテーブルを操作するためのC++ライブラリ:PML4E、PDPTE、PDE、PTEエントリの読み書き、仮想アドレスから物理アドレスへの変換、自己参照テーブルの構築が可能です。
ユーザーモードからのページングテーブル操作。すべてのページングテーブルエントリと値の取得および設定などの操作が提供されます。コードはラージページを認識しています。解説へのリンクはこちらにあります。
vdm::read_phys_t _read_phys =
[&](void* addr, void* buffer, std::size_t size) -> bool
{
return vdm::read_phys(addr, buffer, size);
};
vdm::write_phys_t _write_phys =
[&](void* addr, void* buffer, std::size_t size) -> bool
{
return vdm::write_phys(addr, buffer, size);
};
vdm::vdm_ctx vdm(_read_phys, _write_phys);
nasa::mem_ctx my_proc(vdm);
const auto ntoskrnl_base =
reinterpret_cast<void*>(
util::get_kmodule_base("ntoskrnl.exe"));
const auto ntoskrnl_pde = my_proc.get_pde(ntoskrnl_base);
std::printf("[+] pde.present -> %d\n", ntoskrnl_pde.second.present);
std::printf("[+] pde.pfn -> 0x%x\n", ntoskrnl_pde.second.pfn);
std::printf("[+] pde.large_page -> %d\n", ntoskrnl_pde.second.large_page);
[+] pde.present -> 1
[+] pde.pfn -> 0x10400
[+] pde.large_page -> 1
[+] 何かキーを押すと閉じます...