Add support for using a wordlist as stdin for bruteforcing.

Signed-off-by: Edu4rdSHL <edu4rdshl@protonmail.com>
This commit is contained in:
Edu4rdSHL 2021-05-10 10:49:48 -05:00
parent 634a748961
commit 1a435019d8
No known key found for this signature in database
GPG key ID: 3A574A4009F553E5

View file

@ -28,6 +28,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.long("threads") .long("threads")
.takes_value(true) .takes_value(true)
.help("Number of threads. Default: 100"), .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(
Arg::with_name("resolvers") Arg::with_name("resolvers")
@ -101,7 +107,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut buffer = String::new(); let mut buffer = String::new();
let mut stdin = io::stdin(); let mut stdin = io::stdin();
stdin.read_to_string(&mut buffer).await?; stdin.read_to_string(&mut buffer).await?;
let hosts: Vec<String> = buffer.lines().map(str::to_owned).collect();
let hosts: Vec<String> = 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| { futures::stream::iter(hosts.into_iter().map(|host| {
let resolver_fut = resolvers let resolver_fut = resolvers