memexec
Lib used to load and execute PE (Portable Executable) in memory without ever touching the disk
Features
- Applicable to EXE and DLL
- Cross-architecture, applicable to x86 and x86_64
- Zero-dependency
- Contains a zero-copy submodule of PE parser
Install
cargo install memexec
Usage
Load and execute
⚠The architecture of target program must be same as current process, otherwise an error will occur
use memexec;
use File;
use Read;
/***********************************************************/
/* EXE */
/***********************************************************/
let mut buf = Vec new;
open
.unwrap
.read_to_end
.unwrap;
unsafe
/***********************************************************/
/* DLL */
/***********************************************************/
let mut buf = Vec new;
open
.unwrap
.read_to_end
.unwrap;
use DLL_PROCESS_ATTACH;
unsafe
Parse PE
PE parser could parse programs which have different architectures from current process
use PE;
// Zero copy
// Make sure that the lifetime of `buf` is longer than `pe`
let pe = PE new;
println!;
License
The GPLv3 license