diff --git a/.github/workflows/unix.yml b/.github/workflows/unix.yml index 258e704..ae04154 100644 --- a/.github/workflows/unix.yml +++ b/.github/workflows/unix.yml @@ -16,9 +16,13 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Build all for Unix - run: cargo build --verbose - name: Build reverse shell for Unix run: cargo build -p tcp_reverse_shell --verbose + - name: Clean + run: cargo clean - name: Build process migration for Unix run: cargo build -p process_migration --verbose + - name: Clean again + run: cargo clean + - name: Build all for Unix + run: cargo build --verbose diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 2612be2..ad1d3e7 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,9 +20,13 @@ jobs: run: sudo apt -y install mingw-w64 - name: Add Windows build target run: rustup target add x86_64-pc-windows-gnu - - name: Build all for Windows - run: cargo build --target x86_64-pc-windows-gnu --verbose - name: Build reverse shell for Windows run: cargo build -p tcp_reverse_shell --target x86_64-pc-windows-gnu --verbose + - name: Clean + run: cargo clean - name: Build process migration for Windows run: cargo build -p process_migration --target x86_64-pc-windows-gnu --verbose + - name: Clean again + run: cargo clean + - name: Build all for Windows + run: cargo build --target x86_64-pc-windows-gnu --verbose diff --git a/Cargo.toml b/Cargo.toml index 9c06ce2..33750d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,4 +3,4 @@ members = [ "tcp_reverse_shell", "process_migration", -] \ No newline at end of file +] diff --git a/README.md b/README.md index 1429228..3f27ce8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Remote code oxidation (RCO) -[![RCO for Unix targets](https://github.com/kmanc/remote_code_oxidation/actions/workflows/unix.yml/badge.svg?branch=master)](https://github.com/kmanc/remote_code_oxidation/actions/workflows/unix.yml) +[![RCO for Unix targets](https://github.com/kmanc/remote_code_oxidation/actions/workflows/unix.yml/badge.svg)](https://github.com/kmanc/remote_code_oxidation/actions/workflows/unix.yml) -[![RCO for Windows targets](https://github.com/kmanc/remote_code_oxidation/actions/workflows/windows.yml/badge.svg?branch=master)](https://github.com/kmanc/remote_code_oxidation/actions/workflows/windows.yml) +[![RCO for Windows targets](https://github.com/kmanc/remote_code_oxidation/actions/workflows/windows.yml/badge.svg)](https://github.com/kmanc/remote_code_oxidation/actions/workflows/windows.yml) ![language](https://img.shields.io/github/languages/top/kmanc/remote_code_oxidation?style=plastic) @@ -12,48 +12,41 @@ A collection of offensive security tools written in Rust. More details to come ## Tools list - [TCP reverse shell](https://github.com/kmanc/remote_code_oxidation/tree/master/tcp_reverse_shell) - - Navigate to [its config file](https://github.com/kmanc/remote_code_oxidation/blob/master/tcp_reverse_shell/src/config.rs) and change the IP address and port before compiling -- [Shellcode injection and process migration](https://github.com/kmanc/remote_code_oxidation/tree/master/process_migration) - - Navigate to [its config file](https://github.com/kmanc/remote_code_oxidation/blob/master/process_migration/src/config.rs) and change the shellcode before compiling +- [Process migration](https://github.com/kmanc/remote_code_oxidation/tree/master/process_migration) -## Compilation +## Setup ### From Linux host for Linux target Install Rust -``` +```commandline curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -Set up Environment -``` +Add dependencies for compiling +```commandline sudo apt install cmake ``` Build! -``` +```commandline cargo build [-p package_name] [--release] ``` -Example -``` -cargo build -p tcp_reverse_shell --release -``` - ### From Linux host for Windows target -Add dependencies for cross-compiling +Install Rust +```commandline +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` + +Add dependencies for cross-compiling +```commandline sudo apt install mingw-w64 rustup target add x86_64-pc-windows-gnu ``` Build! -``` +```commandline cargo build --target x86_64-pc-windows-gnu [-p package_name] [--release] ``` - -Example -``` -cargo build --target x86_64-pc-windows-gnu -p process_migration --release -``` diff --git a/process_migration/Cargo.toml b/process_migration/Cargo.toml index 25ed096..c74405d 100644 --- a/process_migration/Cargo.toml +++ b/process_migration/Cargo.toml @@ -9,4 +9,12 @@ authors = ["Kevin Conley "] [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 +windows.version = "0.28.0" +windows.features = [ + "Win32_Foundation", + "Win32_Security", + "Win32_System_Diagnostics_Debug", + "Win32_System_Diagnostics_ToolHelp", + "Win32_System_Memory", + "Win32_System_Threading" +] diff --git a/process_migration/README.md b/process_migration/README.md new file mode 100644 index 0000000..cc8b36e --- /dev/null +++ b/process_migration/README.md @@ -0,0 +1,13 @@ +# RCO: Process Migration + +Open [the config file](https://github.com/kmanc/remote_code_oxidation/blob/master/process_migration/src/config.rs) and change the shellcode to your desired payload before compiling + +#### Build for Unix target +```commandline +cargo build -p process_migration --release +``` + +#### Build for Windows target +```commandline +cargo build --target x86_64-pc-windows-gnu -p process_migration --release +``` \ No newline at end of file diff --git a/process_migration/src/main.rs b/process_migration/src/main.rs index 1793da7..15037dc 100644 --- a/process_migration/src/main.rs +++ b/process_migration/src/main.rs @@ -3,16 +3,16 @@ mod config; // Load the appropriate operating system's implementation #[cfg(unix)] -mod rco_proc_mig_unix; +mod rco_process_migration_unix; #[cfg(unix)] -use rco_proc_mig_unix::inject_and_migrate; +use rco_process_migration_unix::inject_and_migrate; #[cfg(windows)] extern crate windows; #[cfg(windows)] -mod rco_proc_mig_windows; +mod rco_process_migration_windows; #[cfg(windows)] -use rco_proc_mig_windows::inject_and_migrate; +use rco_process_migration_windows::inject_and_migrate; fn main() { inject_and_migrate(config::SHELLCODE); diff --git a/process_migration/src/rco_proc_mig_unix/mod.rs b/process_migration/src/rco_process_migration_unix/mod.rs similarity index 100% rename from process_migration/src/rco_proc_mig_unix/mod.rs rename to process_migration/src/rco_process_migration_unix/mod.rs diff --git a/process_migration/src/rco_proc_mig_windows/mod.rs b/process_migration/src/rco_process_migration_windows/mod.rs similarity index 100% rename from process_migration/src/rco_proc_mig_windows/mod.rs rename to process_migration/src/rco_process_migration_windows/mod.rs diff --git a/tcp_reverse_shell/Cargo.toml b/tcp_reverse_shell/Cargo.toml index 596eb0f..bb35518 100644 --- a/tcp_reverse_shell/Cargo.toml +++ b/tcp_reverse_shell/Cargo.toml @@ -9,4 +9,10 @@ authors = ["Kevin Conley "] [dependencies] [target.'cfg(windows)'.dependencies] -windows = { version = "0.28.0", features = ["Win32_Foundation", "Win32_Security", "Win32_Networking_WinSock", "Win32_System_Threading"] } +windows.version = "0.28.0" +windows.features = [ + "Win32_Foundation", + "Win32_Security", + "Win32_Networking_WinSock", + "Win32_System_Threading" +] diff --git a/tcp_reverse_shell/README.md b/tcp_reverse_shell/README.md new file mode 100644 index 0000000..c8c71a4 --- /dev/null +++ b/tcp_reverse_shell/README.md @@ -0,0 +1,13 @@ +# RCO: TCP Reverse Shell + +Open [the config file](https://github.com/kmanc/remote_code_oxidation/blob/master/tcp_reverse_shell/src/config.rs) and change the IP address and port to match your listener before compiling + +#### Build for Unix target +```commandline +cargo build -p tcp_reverse_shell --release +``` + +#### Build for Windows target +```commandline +cargo build --target x86_64-pc-windows-gnu -p tcp_reverse_shell --release +``` \ No newline at end of file diff --git a/tcp_reverse_shell/src/main.rs b/tcp_reverse_shell/src/main.rs index 3fcd62b..8022798 100644 --- a/tcp_reverse_shell/src/main.rs +++ b/tcp_reverse_shell/src/main.rs @@ -3,16 +3,16 @@ mod config; // Load the appropriate operating system's implementation #[cfg(unix)] -mod rco_rev_shell_unix; +mod rco_reverse_shell_unix; #[cfg(unix)] -use rco_rev_shell_unix::shell; +use rco_reverse_shell_unix::shell; #[cfg(windows)] extern crate windows; #[cfg(windows)] -mod rco_rev_shell_windows; +mod rco_reverse_shell_windows; #[cfg(windows)] -use rco_rev_shell_windows::shell; +use rco_reverse_shell_windows::shell; fn main() { shell(config::IP, config::PORT); diff --git a/tcp_reverse_shell/src/rco_rev_shell_unix/mod.rs b/tcp_reverse_shell/src/rco_reverse_shell_unix/mod.rs similarity index 100% rename from tcp_reverse_shell/src/rco_rev_shell_unix/mod.rs rename to tcp_reverse_shell/src/rco_reverse_shell_unix/mod.rs diff --git a/tcp_reverse_shell/src/rco_rev_shell_windows/mod.rs b/tcp_reverse_shell/src/rco_reverse_shell_windows/mod.rs similarity index 100% rename from tcp_reverse_shell/src/rco_rev_shell_windows/mod.rs rename to tcp_reverse_shell/src/rco_reverse_shell_windows/mod.rs