multi process dirbs

this will take a list of URLs and dirb them in parallel, just be careful that the urls aren't on the same server as you'll be hitting that server pretty hard.
This commit is contained in:
Pyro57000
2023-11-20 10:52:22 -06:00
committed by GitHub
parent 0104990296
commit 4cda0708b0
3 changed files with 81 additions and 0 deletions

7
multidirb/Cargo.lock generated Normal file
View File

@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "multidirb"
version = "0.1.0"

8
multidirb/Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "multidirb"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

66
multidirb/src/main.rs Normal file
View File

@@ -0,0 +1,66 @@
use std::fs;
use std::env;
use std::process::{Command, Stdio};
fn tail_file(){
for file in fs::read_dir("./dirb").unwrap(){
println!("{}", file.unwrap().path().display())
}
let mut filename = String::new();
println!("name of the file to watch?");
std::io::stdin().read_line(&mut filename).expect("error reading filename selection");
let filename = format!("./dirb/{}",filename);
Command::new("kitty").arg("tail").arg("-f").arg(filename).spawn().expect("error spawning tail window");
}
fn kill_all_dirbs(){
Command::new("killall").arg("dirb").spawn().expect("error killing");
}
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() != 3{
print!("
USAGE:
multidirb /path/to/urls.txt /path/to/wordlist
")
}
else{
let text = fs::read_to_string(&args[1]).expect("error reading urls file");
fs::create_dir("./dirb").expect("error creating folder");
let lines: Vec<&str> = text.split("\n").collect();
let mut process_count = 0;
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!("./dirb/{}",word_vec[2]);
let outfile = fs::File::create(filename).expect("error creating output file");
let command_output = Stdio::from(outfile);
Command::new("dirb").arg(url).arg(&args[2]).stdout(command_output).spawn().expect("error running dirb command");
process_count = process_count +1;
}
}
}
/* let option_loop = true;
while option_loop{
let mut option = String::new();
print!("
{} processes created
1.) exit leaving processes running
2.) exit killing all processes
3.) watch an output file
", process_count);
std::io::stdin().read_line(&mut option).expect("error reading option selection");
match option.as_str(){
"1\n" => {break},
"2\n" => {kill_all_dirbs(); break},
"3\n" => tail_file(),
_=>println!("unknown option"),
}
}*/
}
}