From 4cda0708b00ecf60fbcf8bfaf80c434ce9a88136 Mon Sep 17 00:00:00 2001 From: Pyro57000 <147988717+Pyro57000@users.noreply.github.com> Date: Mon, 20 Nov 2023 10:52:22 -0600 Subject: [PATCH] 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. --- multidirb/Cargo.lock | 7 +++++ multidirb/Cargo.toml | 8 ++++++ multidirb/src/main.rs | 66 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 multidirb/Cargo.lock create mode 100644 multidirb/Cargo.toml create mode 100644 multidirb/src/main.rs diff --git a/multidirb/Cargo.lock b/multidirb/Cargo.lock new file mode 100644 index 0000000..3ac553d --- /dev/null +++ b/multidirb/Cargo.lock @@ -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" diff --git a/multidirb/Cargo.toml b/multidirb/Cargo.toml new file mode 100644 index 0000000..4c90c1e --- /dev/null +++ b/multidirb/Cargo.toml @@ -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] diff --git a/multidirb/src/main.rs b/multidirb/src/main.rs new file mode 100644 index 0000000..0effe0e --- /dev/null +++ b/multidirb/src/main.rs @@ -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 = 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"), + } + }*/ + } +} \ No newline at end of file