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.
PTM/README.md

51 lines
1.4 KiB

4 years ago
<div align="center">
<div>
<img src="https://imgur.com/AULtct3.png"/>
</div>
</div>
4 years ago
4 years ago
# credit
4 years ago
* buck - inspiration for most of this.
* Ch40zz - helping me connect the dots.
4 years ago
4 years ago
# nasa-tables
4 years ago
paging table manipulation from user-mode. operations such as getting and setting all paging table entries and values are offered. the code is aware of large pages and allows the programmer to allocate 2mb pages if needed (without going through all of the shenanigans of breaking a 2mb page down over a new PT handled by the user). Link to write up can be found [here](https://back.engineering/post/virtual-memory/).
4 years ago
4 years ago
# example
```cpp
4 years ago
vdm::vdm_ctx vdm;
nasa::mem_ctx my_proc(vdm);
const auto ntoskrnl_base =
4 years ago
reinterpret_cast<void*>(
util::get_kmodule_base("ntoskrnl.exe"));
4 years ago
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);
4 years ago
```
```
4 years ago
[+] pde.present -> 1
[+] pde.pfn -> 0x10400
[+] pde.large_page -> 1
[+] press any key to close...
4 years ago
```
4 years ago
# table entry manipulation
- get/set pml4e's
- get/set pdpte's
- get/set pde's
- get/set pte's
# table manipulation
- copy table
- make self referencing table.
# virtual memory
- convert virtual addresses to physical addresses
- get table entries for a given address
4 years ago
- change table entries for a given address