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]
indicatif = "0.17.7"
reqwest = "0.11.22"
tokio = { version = "1.33.0", features = ["rt-multi-thread", "macros"] }
users = "0.11.0"

View File

@ -1,13 +1,14 @@
use indicatif::{ProgressBar, ProgressState, ProgressStyle};
use security_checker::{
get_home,
structs::{Folder, FolderPerms, Perms},
structs::{Data, Folder, FolderPerms, Perms},
};
use std::{
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
if std::env::consts::OS != "linux" {
println!("This currently only supports linux. Sorry!");
@ -16,8 +17,11 @@ fn main() {
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
let mut out: Vec<Folder> = vec![];
thread::spawn(|| async move {
let mut vulnerable_folders: Vec<Folder> = vec![];
let current_user = users::get_effective_uid();
// vulnerable folders
let folders = Folder::linux();
for mut folder in folders {
folder.path = folder.path.replace('~', &get_home()[..]);
@ -32,14 +36,26 @@ fn main() {
// clippy hates this.
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) {
out.push(folder)
vulnerable_folders.push(folder)
} 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...");
@ -65,18 +81,22 @@ fn main() {
pb.finish();
println!("Ran SCAM. Here's your output!");
let recieved = rx.recv().unwrap();
let recieved = rx.recv();
println!("{recieved:?}");
for folder in recieved {
println!(
"I can {} {}. This is potentially bad, because this folder stores {}.",
match folder.dangerous_perms {
FolderPerms::Write => "write to",
FolderPerms::Read => "read from",
FolderPerms::Execute => "execute files in",
},
folder.path,
folder.contains
);
}
// println!("Root: {}", recieved.root);
// println!("Pinged Home: {}", recieved.pinged_home);
// for folder in recieved.vulnerable_folders {
// println!(
// "I can {} {}. This is potentially bad, because this folder stores {}.",
// match folder.dangerous_perms {
// FolderPerms::Write => "write to",
// FolderPerms::Read => "read from",
// FolderPerms::Execute => "execute files in",
// },
// folder.path,
// folder.contains
// );
// }
}

View File

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