run test ssl in parallel against a list of urls

This commit is contained in:
Pyro57000
2023-11-20 10:52:51 -06:00
committed by GitHub
parent 4cda0708b0
commit 4e1e64a5b4
3 changed files with 45 additions and 0 deletions

30
multi_testssl/src/main.rs Normal file
View File

@@ -0,0 +1,30 @@
use std::fs;
use std::env;
use std::process::{Command, Stdio};
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() != 2{
print!("
USAGE:
multidirb /path/to/urls.txt
")
}
else{
let text = fs::read_to_string(&args[1]).expect("error reading urls file");
fs::create_dir("./testssl_output").expect("error creating folder");
let lines: Vec<&str> = text.split("\n").collect();
for line in lines{
let words: Vec<&str> = line.split(" ").collect();
for word in words{
if word.contains("http"){
let url = word;
let word_vec: Vec<&str> = word.split("/").collect();
let filename = format!("./testssl_output/{}",word_vec[2]);
let outfile = fs::File::create(filename).expect("error creating output file");
let command_output = Stdio::from(outfile);
Command::new("testssl").arg(url).stdout(command_output).spawn().expect("error running dirb command");
}
}
}
}
}