From 1a435019d8350e3fe434418066cedf1fac12d739 Mon Sep 17 00:00:00 2001 From: Edu4rdSHL Date: Mon, 10 May 2021 10:49:48 -0500 Subject: [PATCH] Add support for using a wordlist as stdin for bruteforcing. Signed-off-by: Edu4rdSHL --- src/main.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ac123cf..ca6e329 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,6 +28,12 @@ async fn main() -> Result<(), Box> { .long("threads") .takes_value(true) .help("Number of threads. Default: 100"), + ).arg( + Arg::with_name("domain") + .short("d") + .long("domain") + .takes_value(true) + .help("Target domain. When it's specified, a wordlist can be used from stdin for bruteforcing."), ) .arg( Arg::with_name("resolvers") @@ -101,7 +107,16 @@ async fn main() -> Result<(), Box> { let mut buffer = String::new(); let mut stdin = io::stdin(); stdin.read_to_string(&mut buffer).await?; - let hosts: Vec = buffer.lines().map(str::to_owned).collect(); + + let hosts: Vec = if matches.is_present("domain") { + let domain = value_t!(matches, "domain", String).unwrap(); + buffer + .lines() + .map(|word| format!("{}.{}", word, domain)) + .collect() + } else { + buffer.lines().map(str::to_owned).collect() + }; futures::stream::iter(hosts.into_iter().map(|host| { let resolver_fut = resolvers