this may truly be the worst day of my life, but at least i got pinging home working
This commit is contained in:
parent
12ac96f568
commit
cc7b8302df
|
@ -188,6 +188,12 @@ version = "0.3.28"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964"
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.28"
|
||||
|
@ -207,9 +213,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"futures-task",
|
||||
"memchr",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -7,6 +7,6 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
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"] }
|
||||
users = "0.11.0"
|
||||
|
|
34
src/main.rs
34
src/main.rs
|
@ -1,7 +1,7 @@
|
|||
use indicatif::{ProgressBar, ProgressState, ProgressStyle};
|
||||
use security_checker::{
|
||||
get_home,
|
||||
structs::{Data, Folder, FolderPerms, Perms},
|
||||
structs::{Data, Folder, Perms},
|
||||
};
|
||||
use std::{
|
||||
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();
|
||||
|
||||
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 current_user = users::get_effective_uid();
|
||||
let current_group = users::get_effective_gid();
|
||||
|
||||
// vulnerable folders
|
||||
// what folders are vulnerable?
|
||||
let folders = Folder::linux();
|
||||
for mut folder in folders {
|
||||
folder.path = folder.path.replace('~', &get_home()[..]);
|
||||
|
@ -31,9 +40,6 @@ async fn main() {
|
|||
let owner = md.uid();
|
||||
let group = md.gid();
|
||||
|
||||
let current_user = users::get_effective_uid();
|
||||
let current_group = users::get_effective_gid();
|
||||
|
||||
// clippy hates this.
|
||||
if owner == current_user && perms.owner.contains(&folder.dangerous_perms) {
|
||||
vulnerable_folders.push(folder)
|
||||
|
@ -44,14 +50,18 @@ async fn main() {
|
|||
};
|
||||
}
|
||||
|
||||
// ping home
|
||||
let ping = reqwest::get("https://sadlynotsappho.dev/scam").await;
|
||||
// can i ping home?
|
||||
let ping = reqwest::get("https://sadlynotsappho.dev/scam")
|
||||
.await
|
||||
.is_ok();
|
||||
|
||||
// is the current user root?
|
||||
let root = current_user == 0;
|
||||
|
||||
tx.send(Data {
|
||||
vulnerable_folders,
|
||||
root,
|
||||
pinged_home: ping.is_ok(),
|
||||
pinged_home: ping,
|
||||
cam_access: false,
|
||||
mic_access: false,
|
||||
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
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue