Skip to content

Commit

Permalink
Add support for using a wordlist as stdin for bruteforcing.
Browse files Browse the repository at this point in the history
Signed-off-by: Edu4rdSHL <edu4rdshl@protonmail.com>
  • Loading branch information
Edu4rdSHL committed May 10, 2021
1 parent 634a748 commit 1a43501
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.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")
Expand Down Expand Up @@ -101,7 +107,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut buffer = String::new();
let mut stdin = io::stdin();
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| {
let resolver_fut = resolvers
Expand Down

0 comments on commit 1a43501

Please sign in to comment.