1 Commits

Author SHA1 Message Date
pyro 7f8432bda6 fixed url importing to make sure // doesn't occur for sub dirs. 2026-05-18 13:19:41 -05:00
2 changed files with 12 additions and 7 deletions
-1
View File
@@ -13,4 +13,3 @@ indicatif = "0.18.4"
reqwest = { version = "0.12.4", features = ["blocking"] }
tokio = { version = "1.52.3", features = ["full"] }
trust-dns-resolver = "0.23.2"
urlencoding = "2.1.3"
+11 -5
View File
@@ -12,7 +12,6 @@ use std::sync::Arc;
use std::{collections::HashMap, fs};
use tokio::sync::mpsc::{channel, Sender};
use trust_dns_resolver::{config::*, TokioAsyncResolver};
use urlencoding::encode;
enum OutputMessage {
UrlResult(String),
@@ -102,20 +101,20 @@ async fn try_sub(
}
async fn try_dir(url: String, tx: Sender<OutputMessage>, output: bool, pb: Arc<ProgressBar>) {
let resp_stat = reqwest::get(&encode(&url).to_string()).await;
let resp_stat = reqwest::get(&url).await;
if resp_stat.is_ok() {
let resp = resp_stat.unwrap().status();
match resp {
StatusCode::OK => {
if output {
if let Err(e) = tx
.send(OutputMessage::UrlResult(format!("{} {}", resp, url)))
.send(OutputMessage::UrlResult(format!("{} {}", resp, &url)))
.await
{
eprintln!("error sending output! {}", e);
}
}
pb.println(&format!("{} {}", resp, url));
pb.println(&format!("{} {}", resp, &url));
}
StatusCode::ACCEPTED => {
if output {
@@ -170,7 +169,10 @@ async fn try_dir(url: String, tx: Sender<OutputMessage>, output: bool, pb: Arc<P
eprintln!("error sending output! {}", e);
}
}
pb.println(&format!("{} {}", resp, url));
pb.println(&format!(
"{} {} - and what a beautiful teapot you are!",
resp, url
));
}
StatusCode::MOVED_PERMANENTLY => {
if output {
@@ -354,11 +356,15 @@ async fn main() {
for dir in dirwordlist.split("\n").collect::<Vec<&str>>() {
for target in &targets {
if target.contains("http") {
if dir.starts_with("/") || target.ends_with("/") {
dirs_to_try.push(format!("{}{}", target, dir.trim()));
} else {
dirs_to_try.push(format!("{}/{}", target, dir.trim()));
}
}
}
}
}
if args.subwordlist != String::from("none") {
let subwordlist =
fs::read_to_string(args.subwordlist).expect("error reading subdomain word list");