this may truly be the worst day of my life, but at least i got pinging home working

This commit is contained in:
SadlyNotSappho 2023-10-13 11:26:20 -07:00
parent 12ac96f568
commit cc7b8302df
3 changed files with 35 additions and 10 deletions

9
Cargo.lock generated
View File

@ -188,6 +188,12 @@ version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
[[package]]
name = "futures-io"
version = "0.3.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.28" version = "0.3.28"
@ -207,9 +213,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-io",
"futures-task", "futures-task",
"memchr",
"pin-project-lite", "pin-project-lite",
"pin-utils", "pin-utils",
"slab",
] ]
[[package]] [[package]]

View File

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

View File

@ -1,7 +1,7 @@
use indicatif::{ProgressBar, ProgressState, ProgressStyle}; use indicatif::{ProgressBar, ProgressState, ProgressStyle};
use security_checker::{ use security_checker::{
get_home, get_home,
structs::{Data, Folder, FolderPerms, Perms}, structs::{Data, Folder, 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,
@ -17,11 +17,20 @@ async fn main() {
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();
thread::spawn(|| async move { // this. this next line of code. i fucking hate everything. this was fucking awful. all i had
// to do was scroll down on the forum post but NO i'm too fucking stupid for that. i hate being
// alive i hate being a programmer i hate rust i have a bio final in like three hours and i'm
// in a shit mood because of that and then THIS
//
// like cmon
//
// FUCKING THIS????
tokio::spawn(async move {
let mut vulnerable_folders: Vec<Folder> = vec![]; let mut vulnerable_folders: Vec<Folder> = vec![];
let current_user = users::get_effective_uid(); let current_user = users::get_effective_uid();
let current_group = users::get_effective_gid();
// vulnerable folders // what folders are vulnerable?
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()[..]);
@ -31,9 +40,6 @@ async fn main() {
let owner = md.uid(); let owner = md.uid();
let group = md.gid(); let group = md.gid();
let current_user = users::get_effective_uid();
let current_group = users::get_effective_gid();
// 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) {
vulnerable_folders.push(folder) vulnerable_folders.push(folder)
@ -44,14 +50,18 @@ async fn main() {
}; };
} }
// ping home // can i ping home?
let ping = reqwest::get("https://sadlynotsappho.dev/scam").await; let ping = reqwest::get("https://sadlynotsappho.dev/scam")
.await
.is_ok();
// is the current user root?
let root = current_user == 0; let root = current_user == 0;
tx.send(Data { tx.send(Data {
vulnerable_folders, vulnerable_folders,
root, root,
pinged_home: ping.is_ok(), pinged_home: ping,
cam_access: false, cam_access: false,
mic_access: false, mic_access: false,
known_malware: vec![], known_malware: vec![],
@ -100,3 +110,9 @@ async fn main() {
// ); // );
// } // }
} }
// async fn ping_home() -> String {
// let str = reqwest::get("https://sadlynotsappho.dev/scam").await.unwrap().text().await.unwrap().to_string();
// println!("{str}");
// str
// }