summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamilskyy <alive6863@gmail.com>2025-11-04 21:54:48 +0300
committerNamilskyy <alive6863@gmail.com>2025-11-04 22:05:30 +0300
commitaeadb1b58e4f9ef2f6e4ee112408ca80f68398a8 (patch)
tree4377c7191da21599df75b3a9f2c8a5f80b97e9af
parent3b0f8d460a549a91b9555e8edeb36c02d41e73cd (diff)
Added two more complex methods of destroying graphical servers in `src/non_critical/gui_destroyer.rs`.
New depends: libx11, wayland_client
-rw-r--r--Cargo.lock122
-rw-r--r--Cargo.toml2
-rw-r--r--aur/.SRCINFO18
-rw-r--r--src/non_critical/_tools.c9
-rw-r--r--src/non_critical/_tools.h1
-rw-r--r--src/non_critical/gui_destroyer.rs117
-rw-r--r--src/non_critical/mod.rs3
7 files changed, 256 insertions, 16 deletions
diff --git a/Cargo.lock b/Cargo.lock
index a7f501a..9ea1155 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -53,6 +53,18 @@ dependencies = [
]
[[package]]
+name = "autocfg"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
name = "cc"
version = "1.2.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -115,6 +127,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]]
+name = "downcast-rs"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
+
+[[package]]
name = "find-msvc-tools"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -151,12 +169,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
[[package]]
+name = "memoffset"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "nix"
+version = "0.24.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069"
+dependencies = [
+ "bitflags",
+ "cfg-if",
+ "libc",
+ "memoffset",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.21.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+
+[[package]]
name = "once_cell_polyfill"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
+name = "pkg-config"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
+
+[[package]]
name = "ppv-lite86"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -225,6 +276,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
+name = "smallvec"
+version = "1.15.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+
+[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -237,6 +294,8 @@ dependencies = [
"cc",
"clap",
"rand",
+ "wayland-client",
+ "x11",
]
[[package]]
@@ -272,6 +331,53 @@ dependencies = [
]
[[package]]
+name = "wayland-client"
+version = "0.29.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715"
+dependencies = [
+ "bitflags",
+ "downcast-rs",
+ "libc",
+ "nix",
+ "wayland-commons",
+ "wayland-scanner",
+ "wayland-sys",
+]
+
+[[package]]
+name = "wayland-commons"
+version = "0.29.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902"
+dependencies = [
+ "nix",
+ "once_cell",
+ "smallvec",
+ "wayland-sys",
+]
+
+[[package]]
+name = "wayland-scanner"
+version = "0.29.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "xml-rs",
+]
+
+[[package]]
+name = "wayland-sys"
+version = "0.29.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4"
+dependencies = [
+ "pkg-config",
+]
+
+[[package]]
name = "windows-link"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -358,6 +464,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"
[[package]]
+name = "x11"
+version = "2.21.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e"
+dependencies = [
+ "libc",
+ "pkg-config",
+]
+
+[[package]]
+name = "xml-rs"
+version = "0.8.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ae8337f8a065cfc972643663ea4279e04e7256de865aa66fe25cec5fb912d3f"
+
+[[package]]
name = "zerocopy"
version = "0.8.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 1f76662..bc2d20f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,8 @@ authors = ["Borisov Alexey <arcanetmod@gmail.com>"]
[dependencies]
clap = { version = "4.5.49", features = ["derive"] }
rand = "0.9.2"
+wayland-client = "0.29.0"
+x11 = "2.21.0"
[build-dependencies]
cc = "1.1"
diff --git a/aur/.SRCINFO b/aur/.SRCINFO
new file mode 100644
index 0000000..edca029
--- /dev/null
+++ b/aur/.SRCINFO
@@ -0,0 +1,18 @@
+pkgbase = suicidekit
+ pkgdesc = A utility to help you beautifully deal with your *NIX system. (break it). Now work in progress.
+ pkgver = 0.1
+ pkgrel = 1
+ url = https://github.com/Nam4ik/suicidekit
+ arch = i686
+ arch = x86_64
+ arch = aarch64
+ license = BSD-2-Clause
+ makedepends = cargo
+ depends = bash
+ depends = rust
+ depends = alsa-lib
+ depends = gcc
+ source = https://github.com/Nam4ik/syskill/archive/refs/tags/v1.tar.gz
+ sha256sums = SKIP
+
+pkgname = suicidekit
diff --git a/src/non_critical/_tools.c b/src/non_critical/_tools.c
index f152df2..4b6159d 100644
--- a/src/non_critical/_tools.c
+++ b/src/non_critical/_tools.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <string.h>
@@ -40,4 +41,12 @@ char* get_os_name() {
fclose(file);
return NULL;
+}
+
+char* get_desktop_server() {
+ if(getenv("XDG_SESSION_TYPE") != NULL) {
+ return getenv("XDG_SESSION_TYPE");
+ } else {
+ return NULL;
+ }
} \ No newline at end of file
diff --git a/src/non_critical/_tools.h b/src/non_critical/_tools.h
index e56b194..fd8e6bd 100644
--- a/src/non_critical/_tools.h
+++ b/src/non_critical/_tools.h
@@ -3,3 +3,4 @@
int check_root();
int check_pid();
char* get_os_name();
+char* get_desktop_server(); \ No newline at end of file
diff --git a/src/non_critical/gui_destroyer.rs b/src/non_critical/gui_destroyer.rs
index ae5dd32..aafc05a 100644
--- a/src/non_critical/gui_destroyer.rs
+++ b/src/non_critical/gui_destroyer.rs
@@ -1,43 +1,128 @@
#![no_main]
#![feature(let_chains)]
-use std::process;
-use std::io::{Error, Write};
-use std::fs::File;
+use std::ffi::CStr;
+use std::io::Write;
+use std::ptr;
+use std::fs::OpenOptions;
+use std::os::unix::io::{AsRawFd, IntoRawFd};
+use std::os::raw::c_char;
+use std::error::Error;
+
use rand::{Rng};
+use x11::xlib;
+use wayland_client::{Display, GlobalManager, Main};
+use wayland_client::protocol::wl_shm::WlShm;
+
extern "C" {
fn check_root() -> i32;
+ fn get_desktop_server() -> *mut c_char;
}
// Pfff its to light for this project, but why not
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();
+ let procs: [&str; 10] = ["X", "Xwayland", "Xorg", "i3", "i3status", "i3lock", "i3status", "i3lock", "i3status", "i3lock"];
+ let root_chk: i32 = unsafe { check_root() };
+
+ if root == true && root_chk == 0 {
+
+ for i in 0..procs.len() {
+ std::process::Command::new("pkill")
+ .args(&["-9", procs[i]])
+ //TODO: Add more process names of the processes you want to kill
+ .spawn().unwrap();
+ }
- 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..iterations {
let garbage: Vec<u8> = (0..1024).map(|_| rng.gen()).collect();
let _ = fb.write(&garbage);
}
+
+ } else {
- }
+ unsafe {
+ let ptr = get_desktop_server();
+ if ptr.is_null() {
+ panic!("XDG_SESSION_TYPE not set");
+ }
+
+ if CStr::from_ptr(ptr).to_str().unwrap() == "wayland" {
+ wayland_corrupt_buffer().unwrap();
+ } else {
+ artifacts_x11();
+ }
+ }
+ }
Ok(())
}
-/*
-fn init() -> Result<(), std::io::Error> {
- if check_root() == 0 {
- artifacts_and_kill(true)
- } else {
- artifacts_and_kill(false)
+
+unsafe fn artifacts_x11() -> xlib::Window {
+ let dsp = xlib::XOpenDisplay(ptr::null());
+ if dsp.is_null() {
+ panic!("Couldnt open XServer conn.");
}
+
+ let screen = xlib::XDefaultScreen(dsp);
+ let root_window = xlib::XRootWindow(dsp, screen);
+
+ let mut xattr: xlib::XSetWindowAttributes = std::mem::zeroed();
+ xattr.background_pixel = xlib::XBlackPixel(dsp, screen);
+
+ // Создаем окно с потенциально проблемными параметрами
+ let win = xlib::XCreateWindow(
+ dsp,
+ root_window,
+ 0, // x
+ 0, // y
+ 100, // width
+ 100, // height
+ 0, // border_width
+ xlib::CopyFromParent as i32, // depth
+ xlib::InputOutput as u32, // class
+ ptr::null_mut(), // visual - используем null вместо *CopyFromParent
+ xlib::CWBackPixel as u64, // value_mask
+ &mut xattr // attributes
+ );
+
+ win
+}
+
+fn wayland_corrupt_buffer() -> Result<(), Box<dyn Error>> {
+ let display = Display::connect_to_env()?;
+ let mut event_queue = display.create_event_queue();
+ let attached = display.attach(event_queue.token());
+
+ let globals = GlobalManager::new(&attached);
+ event_queue.sync_roundtrip(&mut (), |_, _, _| {})?;
+
+ let shm: Main<WlShm> = globals
+ .instantiate_exact::<WlShm>(1)
+ .map_err(|_| "wl_shm not available")?;
+
+ let tmp_path = std::env::temp_dir().join(format!("wl_broken_{}.tmp", std::process::id()));
+ let mut f = OpenOptions::new()
+ .read(true)
+ .write(true)
+ .create(true)
+ .truncate(true)
+ .open(&tmp_path)?;
+ f.set_len(4096)?;
+ let raw_fd = f.into_raw_fd();
+
+ let _broken_pool = shm.create_pool(raw_fd, 8192);
+
+ let _ = event_queue.sync_roundtrip(&mut (), |_, _, _| {});
+
+ println!("Broken pool creating request sent to Wayland.");
+ Ok(())
+
}
-*/
+// ITS HAVE TO MUCH SHITCODE FOR 1 FILE \ No newline at end of file
diff --git a/src/non_critical/mod.rs b/src/non_critical/mod.rs
index abc91c8..959a8ee 100644
--- a/src/non_critical/mod.rs
+++ b/src/non_critical/mod.rs
@@ -7,6 +7,7 @@ extern "C" {
pub fn check_root() -> c_int;
pub fn check_pid(pid: c_int) -> c_int;
pub fn get_os_name() -> *mut c_char;
+ pub fn get_desktop_server() -> *mut c_char;
// Random sounds
pub fn init_random_sounds(threads: c_int, time: c_int) -> c_int;
@@ -15,6 +16,8 @@ extern "C" {
// Syscall storm
pub fn init_syscall_storm(threads: c_int, iterations: c_int) -> c_int;
pub fn stop_syscall_storm();
+
+
}