forked from lbjlaq/Antigravity-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.rs
More file actions
46 lines (38 loc) · 1.69 KB
/
Copy pathtest.rs
File metadata and controls
46 lines (38 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use sysinfo::System;
fn main() {
let mut system = System::new();
system.refresh_processes(sysinfo::ProcessesToUpdate::All);
let mut immune_exe_paths = std::collections::HashSet::new();
for (_pid, process) in system.processes() {
let args = process.cmd();
let args_str = args
.iter()
.map(|arg| arg.to_string_lossy().to_lowercase())
.collect::<Vec<String>>()
.join(" ");
if args_str.contains("antigravity ide") || args_str.contains("antigravity-ide") {
if let Some(exe_path) = process.exe().and_then(|p| p.to_str()) {
immune_exe_paths.insert(exe_path.to_lowercase());
}
}
}
println!("Immune paths: {:?}", immune_exe_paths);
for (pid, process) in system.processes() {
let name = process.name().to_string_lossy().to_lowercase();
let exe_path = process.exe().and_then(|p| p.to_str()).unwrap_or("").to_lowercase();
if !name.contains("antigravity") { continue; }
let is_ide_match = if immune_exe_paths.contains(&exe_path) {
false
} else {
(exe_path.contains("antigravity") || name.contains("antigravity"))
&& !exe_path.contains("antigravity ide")
&& !exe_path.contains("antigravity-ide")
&& !name.contains("antigravity ide")
&& !name.contains("antigravity-ide")
};
let is_helper = process.cmd().iter().any(|arg| arg.to_string_lossy().to_lowercase().contains("--type="));
if is_ide_match && !is_helper {
println!("PID {} ({}) WILL BE KILLED", pid, exe_path);
}
}
}