Fix logic when using stdin recirection as input

Fix Probing issue! #9
This commit is contained in:
Eduard Tolosa 2024-03-17 20:49:43 -05:00
parent b0876d0f16
commit 2888858d4e
4 changed files with 694 additions and 571 deletions

1209
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -12,19 +12,14 @@ readme = "README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.20.1", features = ["full", "io-util"] }
futures = "0.3.23"
clap = "2.33.4"
reqwest = { version = "0.11.11", features = ["trust-dns", "rustls-tls", "native-tls"] }
openssl = { version = "0.10.41", features = ["vendored"] }
tokio = { version = "1.36.0", features = ["full", "io-util"] }
futures = "0.3.30"
clap = "2.34.0"
reqwest = { version = "0.11.24", features = ["trust-dns", "rustls-tls", "native-tls"] }
openssl = { version = "0.10.64", features = ["vendored"] }
rand = "0.8.5"
scraper = "0.13.0"
async-recursion = "1.0.0"
# https://github.com/bluejekyll/trust-dns/pull/1632
[patch.crates-io]
trust-dns-resolver = { git = "https://github.com/Findomain/trust-dns", package = "trust-dns-resolver", branch = "custombranch" }
scraper = "0.19.0"
async-recursion = "1.0.5"
[profile.release]
lto = 'thin'

View file

@ -7,7 +7,6 @@ use {
futures::stream::StreamExt,
rand::{distributions::Alphanumeric, thread_rng as rng, Rng},
reqwest::{
self,
header::{CONTENT_LENGTH, CONTENT_TYPE, USER_AGENT},
redirect::Policy,
Client, Response, Url,

View file

@ -2,10 +2,7 @@ use {
clap::{value_t, App, Arg},
fhc::{httplib, structs::LibOptions, utils},
std::collections::HashSet,
tokio::{
self,
io::{self, AsyncReadExt},
},
tokio::io::{self, AsyncReadExt},
};
#[tokio::main]
@ -55,6 +52,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.takes_value(true)
.help("Max number of redirects. Default: 0"),
)
.arg(
Arg::with_name("bruteforce")
.short("b")
.long("bruteforce")
.takes_value(false)
.help("Bruteforce subdomains."),
)
.arg(
Arg::with_name("1xx")
.short("1")
@ -115,20 +119,24 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = httplib::return_http_client(timeout, max_redirects);
// Read stdin
let mut stdin = io::stdin();
let mut buffer = String::new();
stdin.read_to_string(&mut buffer).await?;
let hosts: HashSet<String> = if matches.is_present("domain") {
let mut hosts = HashSet::new();
if matches.is_present("domain") {
let domain = value_t!(matches, "domain", String).unwrap();
buffer
if matches.is_present("bruteforce") {
io::stdin().read_to_string(&mut buffer).await?;
hosts = buffer
.lines()
.map(|word| format!("{word}.{domain}"))
.collect()
.collect();
} else {
buffer.lines().map(str::to_owned).collect()
hosts.insert(domain);
}
} else {
io::stdin().read_to_string(&mut buffer).await?;
hosts = buffer.lines().map(str::to_owned).collect();
};
let lib_options = LibOptions {