Expand description
The MemProcFS Rust API Documentation
The MemProcFS crate contains a wrapper API around the MemProcFS physical
memory analysis framework. The native
libray in the form of vmm.dll or vmm.so must be downloaded or compiled
in order to make use of the memprocfs rust crate.
The aim of the MemProcFS rust crate and rust API is to make MemProcFS usage as easy and smooth as possible on Rust! Please let me know what you think or if you have any improvement suggestions!
Physical memory analysis may take place on memory dump files for forensic purposes. Analysis may also take place on live memory - either captured by using PCILeech PCIe DMA devices or by using a driver - such as WinPMEM, LiveCloudKd, VMware or similar.
The base of the MemProcFS API is the Vmm struct. Once the native vmm
has been initialized it’s possible to retrieve processes in the form of
the VmmProcess struct. Using the Vmm and VmmProcess it’s
possible to undertake a wide range of actions - such as reading/writing
memory or retrieve various information.
Read and write memory by using the methods mem_read(),
mem_read_ex(), mem_write() of the Vmm and VmmProcess structs.
Virtual memory is read from individual processes. Physical memory is read
from the base vmm.
Efficiently read and write memory using the VmmScatterMemory
struct. The scatter struct is retrieved by calling mem_scatter() on
either the base Vmm struct or the individual VmmProcess structs.
Access the Virtual File System (VFS) using the Rust API to get access
to the full range of built-in and external plugins. The VFS is accessed by
using the methods vmm.vfs_list(), vmm.vfs_read(), vmm.vfs_write()
on the Vmm struct.
The MemProcFS rust API supports creation of native MemProcFS plugins in
the form of a library .dll or .so for the more advanced user.
Example documentation
Check out the example documentation, both in the form of the example project and the example MemProcFS plugin
Project documentation
Check out the project documentation for MemProcFS, LeechCore and pcileech-fpga:
License
MemProcFS and its rust API is open source under the AGPL-3.0 license.
Support PCILeech/MemProcFS development:
PCILeech and MemProcFS is free and open source!
I put a lot of time and energy into PCILeech and MemProcFS and related research to make this happen. Some aspects of the projects relate to hardware and I put quite some money into my projects and related research. If you think PCILeech and/or MemProcFS are awesome tools and/or if you had a use for them it’s now possible to contribute by becoming a sponsor!
If you like what I’ve created with PCIleech and MemProcFS with regards to DMA, Memory Analysis and Memory Forensics and would like to give something back to support future development please consider becoming a sponsor at: https://github.com/sponsors/ufrisk
To all my sponsors, Thank You 💖
Questions and Comments
Please feel free to contact me!
- Github: https://github.com/ufrisk/MemProcFS
- Discord #pcileech channel at the Porchetta server.
- Twitter: https://twitter.com/UlfFrisk
- Email: pcileech@frizk.net
Future work
Functionality haven’t yet made it into the API, but will be added in the near future!
- Completed Registry API
- Search API
Get Started!
Check out the Vmm documentation and the example project!
Best wishes with your memory analysis Rust project!
Structs
- MemProcFS API Base Struct.
- Kernel information.
- Info: Physical memory map entries.
- Info: Network connections.
- Info: Memory PFN (Page Frame Number).
- Info: Kernel pool entries.
- Info: Services.
- Info: Users.
- Info: Virtual Machines (VMs).
- Debug Symbol API.
- Plugin Context: Supplied by MemProcFS to plugin callback functions.
- Plugin File List: Supplied by MemProcFS to plugin list callback function.
- Plugin Initialization Context.
- Plugin Initialization System Information.
- Process API Base Struct.
- Process Information.
- Info: Process Module: PE data directories.
- Info: Process Module: PE exported entries.
- Info: Process: Handles.
- Info: Process: Heap allocations.
- Info: Process: Heaps.
- Info: Process Module: PE imported entries.
- Info: Process: Modules (loaded DLLs) debug information.
- Info: Process: Modules (loaded DLLs).
- Info: Process: Modules (loaded DLLs) version information.
- Info: Process: PTE memory map entries.
- Info: Process: Threads.
- Info: Process: Unloaded modules.
- Info: Process: VAD (Virtual Address Descriptor) memory map entries.
- Info: Process: Extended VAD memory map entries.
- Info: Process Module: PE sections.
- Registry Hive API.
- Efficient Memory Reading API.
- VFS (Virtual File System) entry information - file or directory.
Enums
Constants
- Set native library internal custom debug.
- Get/Set enable paging support 1/0.
- Get whether the refresh is enabled or not (1/0).
- Get/Set process refresh (partial) period (in ticks).
- Get/Set process refresh (full) period (in ticks).
- Get/Set memory cache validity period (in ticks).
- Get/Set enable function call statistics (.status/statistics_fncall file)
- Get/Set base tick period in ms.
- Get/Set page table (tlb) cache validity period (in ticks).
- Get MemProcFS major version.
- Get MemProcFS minor version.
- Get MemProcFS revision version.
- Get max native physical memory address.
- Get the numeric memory model type according to the VMM C-API.
- Get/Set library console printouts.
- Get the numeric system type according to VMM C-API.
- Get/Set standard verbosity.
- Get/Set extra verbosity.
- Get/Set super extra verbosity and PCIe TLP debug.
- Get/Set enable/retrieve forensic mode type [0-4].
- Set custom process directory table base. [LO-DWORD: Process PID].
- Set - trigger refresh all caches.
- Set - refresh fast frequency - incl. partial process refresh.
- Set - refresh medium frequency - incl. full process refresh.
- Set - refresh memory cache (excl. TLB) (fully)
- Set - refresh memory cache (excl. TLB) [partial 33%/call]
- Set - refresh slow frequency.
- Set - refresh page table (TLB) cache (fully)
- Set - refresh page table (TLB) cache [partial 33%/call]
- Get MemProcFS unique system id.
- Get OS version build.
- Get OS version major.
- Get OS version minor.
- Only fetch from the most recent active cache region when reading.
- Force use of data cache - fail non-cached pages.
- Disable/override any use of VMM_FLAG_FORCECACHE_READ.
- Do not use internal data cache.
- Do not populate the data cache on a successful read.
- Do not retrieve memory from paged out memory.
- Do not retrieve memory from paged out memory***.
- Do not perform additional predictive page reads.
- Zero pad failed memory reads and report success.
- Forensic mode initialization start.
- Forensic mode processing is completed.
- Fast refresh. Partial process refresh.
- Medium refresh. Full process refresh and other refresh tasks.
- Slow refresh. Total refresh of as much as possible.
- Verbosity change. Query new verbosity with:
vmm.get_config(). - A child VM was attached or detached. Query new state with API.
Functions
- Initialize plugin information and initialization context.
Type Definitions
- Result type for MemProcFS API.