it hates me

This commit is contained in:
SadlyNotSappho 2023-10-10 12:03:51 -07:00
parent ce82000bb4
commit 12ac96f568
4 changed files with 1117 additions and 42 deletions

1068
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,4 +7,6 @@ edition = "2021"
[dependencies] [dependencies]
indicatif = "0.17.7" indicatif = "0.17.7"
reqwest = "0.11.22"
tokio = { version = "1.33.0", features = ["rt-multi-thread", "macros"] }
users = "0.11.0" users = "0.11.0"

View File

@ -1,13 +1,14 @@
use indicatif::{ProgressBar, ProgressState, ProgressStyle}; use indicatif::{ProgressBar, ProgressState, ProgressStyle};
use security_checker::{ use security_checker::{
get_home, get_home,
structs::{Folder, FolderPerms, Perms}, structs::{Data, Folder, FolderPerms, Perms},
}; };
use std::{ use std::{
fmt::Write, fs, os::unix::prelude::MetadataExt, process, sync::mpsc, thread, time::Duration, fmt::Write, fs, os::unix::prelude::MetadataExt, process, sync::mpsc, thread, time::Duration,
}; };
fn main() { #[tokio::main]
async fn main() {
// TODO: add support for other OSes // TODO: add support for other OSes
if std::env::consts::OS != "linux" { if std::env::consts::OS != "linux" {
println!("This currently only supports linux. Sorry!"); println!("This currently only supports linux. Sorry!");
@ -16,8 +17,11 @@ fn main() {
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();
thread::spawn(move || { thread::spawn(|| async move {
let mut out: Vec<Folder> = vec![]; let mut vulnerable_folders: Vec<Folder> = vec![];
let current_user = users::get_effective_uid();
// vulnerable folders
let folders = Folder::linux(); let folders = Folder::linux();
for mut folder in folders { for mut folder in folders {
folder.path = folder.path.replace('~', &get_home()[..]); folder.path = folder.path.replace('~', &get_home()[..]);
@ -32,14 +36,26 @@ fn main() {
// clippy hates this. // clippy hates this.
if owner == current_user && perms.owner.contains(&folder.dangerous_perms) { if owner == current_user && perms.owner.contains(&folder.dangerous_perms) {
out.push(folder) vulnerable_folders.push(folder)
} else if group == current_group && perms.group.contains(&folder.dangerous_perms) { } else if group == current_group && perms.group.contains(&folder.dangerous_perms) {
out.push(folder) vulnerable_folders.push(folder)
} else if perms.other.contains(&folder.dangerous_perms) { } else if perms.other.contains(&folder.dangerous_perms) {
out.push(folder) vulnerable_folders.push(folder)
}; };
} }
tx.send(out)
// ping home
let ping = reqwest::get("https://sadlynotsappho.dev/scam").await;
let root = current_user == 0;
tx.send(Data {
vulnerable_folders,
root,
pinged_home: ping.is_ok(),
cam_access: false,
mic_access: false,
known_malware: vec![],
})
}); });
println!("SCAMing you..."); println!("SCAMing you...");
@ -65,18 +81,22 @@ fn main() {
pb.finish(); pb.finish();
println!("Ran SCAM. Here's your output!"); println!("Ran SCAM. Here's your output!");
let recieved = rx.recv().unwrap(); let recieved = rx.recv();
println!("{recieved:?}");
for folder in recieved { // println!("Root: {}", recieved.root);
println!( // println!("Pinged Home: {}", recieved.pinged_home);
"I can {} {}. This is potentially bad, because this folder stores {}.",
match folder.dangerous_perms { // for folder in recieved.vulnerable_folders {
FolderPerms::Write => "write to", // println!(
FolderPerms::Read => "read from", // "I can {} {}. This is potentially bad, because this folder stores {}.",
FolderPerms::Execute => "execute files in", // match folder.dangerous_perms {
}, // FolderPerms::Write => "write to",
folder.path, // FolderPerms::Read => "read from",
folder.contains // FolderPerms::Execute => "execute files in",
); // },
} // folder.path,
// folder.contains
// );
// }
} }

View File

@ -1,13 +1,14 @@
use std::fs; use std::fs;
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
#[derive(Debug)]
pub struct Data { pub struct Data {
pub vulnerable_folders: Vec<Folder>, pub vulnerable_folders: Vec<Folder>, // done
pub pinged_home: bool, pub pinged_home: bool,
pub known_malware: Vec<Malware>, pub root: bool,
pub cam_access: bool, pub cam_access: bool,
pub mic_access: bool, pub mic_access: bool,
pub root: bool, pub known_malware: Vec<Malware>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -26,11 +27,13 @@ pub enum FolderType {
Kernel, Kernel,
} }
#[derive(Debug)]
pub struct Malware { pub struct Malware {
pub ftype: Vec<MalwareType>, pub ftype: Vec<MalwareType>,
pub name: String, pub name: String,
} }
#[derive(Debug)]
pub enum MalwareType { pub enum MalwareType {
DataThief, // sells data to ad companies (cough cough google chrome cough cough) DataThief, // sells data to ad companies (cough cough google chrome cough cough)
LoginStealer, // fuckin skyblock mods, probably LoginStealer, // fuckin skyblock mods, probably
@ -47,56 +50,56 @@ impl Folder {
path: String::from("/usr/bin"), path: String::from("/usr/bin"),
ftype: FolderType::Binary, ftype: FolderType::Binary,
contains: "Installed Programs".to_string(), contains: "Installed Programs".to_string(),
dangerous_perms: FolderPerms::Write dangerous_perms: FolderPerms::Write,
}, },
Folder { Folder {
path: "/boot".to_string(), path: "/boot".to_string(),
ftype: FolderType::Kernel, ftype: FolderType::Kernel,
contains: "Boot Files, Kernel".to_string(), contains: "Boot Files, Kernel".to_string(),
dangerous_perms: FolderPerms::Write dangerous_perms: FolderPerms::Write,
}, },
Folder { Folder {
path: "/lib".to_string(), path: "/lib".to_string(),
ftype: FolderType::SystemData, ftype: FolderType::SystemData,
contains: "Kernel Modules, Libraries".to_string(), contains: "Kernel Modules, Libraries".to_string(),
dangerous_perms: FolderPerms::Write dangerous_perms: FolderPerms::Write,
}, },
Folder { Folder {
path: "/usr/lib".to_string(), path: "/usr/lib".to_string(),
ftype: FolderType::SystemData, ftype: FolderType::SystemData,
contains: "Libraries, Object Files".to_string(), contains: "Libraries, Object Files".to_string(),
dangerous_perms: FolderPerms::Write dangerous_perms: FolderPerms::Write,
}, },
Folder { Folder {
path: "/dev".to_string(), path: "/dev".to_string(),
ftype: FolderType::SystemData, ftype: FolderType::SystemData,
contains: "Access To All Devices".to_string(), contains: "Access To All Devices".to_string(),
dangerous_perms: FolderPerms::Write dangerous_perms: FolderPerms::Write,
}, },
Folder { Folder {
path: "/tmp".to_string(), path: "/tmp".to_string(),
ftype: FolderType::ApplicationData, ftype: FolderType::ApplicationData,
contains: "Temporary Application Data".to_string(), contains: "Temporary Application Data".to_string(),
dangerous_perms: FolderPerms::Read dangerous_perms: FolderPerms::Read,
}, },
// user specific files // user specific files
Folder { Folder {
path: "~/.config".to_string(), path: "~/.config".to_string(),
ftype: FolderType::ApplicationData, ftype: FolderType::ApplicationData,
contains: "Permanent Application Data, Login Info".to_string(), contains: "Permanent Application Data, Login Info".to_string(),
dangerous_perms: FolderPerms::Read dangerous_perms: FolderPerms::Read,
}, },
Folder { Folder {
path: "~/.local/share".to_string(), path: "~/.local/share".to_string(),
ftype: FolderType::ApplicationData, ftype: FolderType::ApplicationData,
contains: String::from("Permanent Application Data, Login Info"), contains: String::from("Permanent Application Data, Login Info"),
dangerous_perms: FolderPerms::Read dangerous_perms: FolderPerms::Read,
}, },
Folder { Folder {
path: "~/.cache".to_string(), path: "~/.cache".to_string(),
ftype: FolderType::ApplicationData, ftype: FolderType::ApplicationData,
contains: "Cached Data From Applications".to_string(), contains: "Cached Data From Applications".to_string(),
dangerous_perms: FolderPerms::Read dangerous_perms: FolderPerms::Read,
}, },
] ]
} }