-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathshell_scan.rs
25 lines (24 loc) · 886 Bytes
/
shell_scan.rs
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
use std::fs::File;
use std::io::{self, BufRead, BufReader};
use std::process::Command;
fn main() {
let file = File::open("targets.txt").expect("Failed to open targets file");
let reader = BufReader::new(file);
for line in reader.lines() {
let target = line.unwrap();
println!("Checking target: {}", target);
let output = Command::new("sh")
.arg("-c")
.arg(format!("curl --silent {}", target))
.output()
.expect("Failed to execute process");
io::stdout().write(&output.stdout).unwrap();
io::stdout().write(&output.stderr).unwrap();
let exit_status = output.status.code().unwrap();
if exit_status == 0 {
println!("Command shell is present on {}", target);
} else {
println!("Command shell is not present on {}", target);
}
}
}