Crates.io | rspe |
lib.rs | rspe |
version | 0.1.2 |
source | src |
created_at | 2023-04-11 15:45:48.798745 |
updated_at | 2023-04-18 11:55:53.140525 |
description | Simple Native Rust Reflective PE loader library |
homepage | |
repository | https://github.com/Thoxy67/rspe/ |
max_upload_size | |
id | 836138 |
size | 3,198,987 |
Simple Native Rust Reflective PE loader library
This project can execute RunPE into memory using the following methods:
use rspe::{reflective_loader, utils::check_dotnet};
// Main function
fn main() -> Result<(), String> {
// Read the file to load into a buffer
#[cfg(target_arch = "x86_64")]
let data = include_bytes!(r#".\putty_x64.exe"#).to_vec();
#[cfg(target_arch = "x86")]
let data = include_bytes!(r#".\putty_x86.exe"#).to_vec();
// Load the file based on the target architecture
// Check if the file is a .NET assembly
if !check_dotnet(data.clone()) {
// If it is not, use the reflective loader to load the file
unsafe {
reflective_loader(data.clone());
// Using Threads (useful to bind 2nd exe to execute at the same time):
// Currently not in use, but can be used to load the pe file in a separate thread
// let handle = std::thread::spawn(move || {
// pe::loader::reflective_loader(data.clone());
// });
// let _ = handle.join();
};
} else {
panic!("This is a .NET PE file. Only native PE image are supported! Please provide a native PE image.")
}
Ok(())
}
Special thanks to the following individuals and projects for their contributions to this project:
This project is licensed under the MIT License - see the LICENSE file for details.