Skip to content

Commit 83700fb

Browse files
author
Blake Jacobs
committed
Fixed a bug with the ETA, it would not produce the correct results.
1 parent ab44111 commit 83700fb

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"editor.tabCompletion": "on",
33
"diffEditor.codeLens": true,
44
"rust-analyzer.linkedProjects": [
5+
".\\Cargo.toml",
56
".\\Cargo.toml",
67
".\\Cargo.toml"
78
]

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "pathbuster"
33
authors = ["zoid", "<[email protected]>"]
44
description = "A path-normalization pentesting tool."
5-
version = "0.5.0"
5+
version = "0.5.1"
66
edition = "2021"
77
license = "MIT"
88
repository = "https://github.com/ethicalhackingplayground/pathbuster"

src/bruteforcer/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::utils;
1515
#[derive(Clone, Debug)]
1616
pub struct BruteResult {
1717
pub data: String,
18+
pub rs: String,
1819
}
1920

2021
// the Job struct which will be used as jobs for directory bruteforcing
@@ -208,9 +209,14 @@ pub async fn run_bruteforcer(
208209
}
209210
};
210211

212+
let content_length = match resp.content_length() {
213+
Some(content_length) => content_length.to_string(),
214+
None => "".to_string(),
215+
};
216+
211217
let (ok, distance_between_responses) =
212218
utils::get_response_change(&internal_resp_text, &public_resp_text);
213-
if ok && (resp.status().as_str() == "200" || resp.status().as_str() == "401") {
219+
if ok && resp.status().as_str() == "200" {
214220
let internal_resp_text_lines = internal_resp_text.lines().collect::<Vec<_>>();
215221
let public_resp_text_lines = public_resp_text.lines().collect::<Vec<_>>();
216222
let character_differences =
@@ -265,6 +271,7 @@ pub async fn run_bruteforcer(
265271
// send the result message through the channel to the workers.
266272
let result_msg = BruteResult {
267273
data: internal_url.to_owned(),
274+
rs: content_length,
268275
};
269276
let result = result_msg.clone();
270277
if let Err(_) = tx.send(result_msg).await {
@@ -276,6 +283,7 @@ pub async fn run_bruteforcer(
276283
}
277284
return BruteResult {
278285
data: "".to_string(),
286+
rs: "".to_string(),
279287
};
280288
}
281289

src/main.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::collections::HashMap;
12
use std::error::Error;
23
use std::io::Write;
34
use std::process::exit;
@@ -38,7 +39,7 @@ fn print_banner() {
3839
/ /_/ / /_/ / /_/ / / / /_/ / /_/ (__ ) /_/ __/ /
3940
/ .___/\__,_/\__/_/ /_/_.___/\__,_/____/\__/\___/_/
4041
/_/
41-
v0.5.0
42+
v0.5.1
4243
------
4344
path normalization pentesting tool
4445
"#;
@@ -80,7 +81,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
8081

8182
// parse the cli arguments
8283
let matches = App::new("pathbuster")
83-
.version("0.5.0")
84+
.version("0.5.1")
8485
.author("Blake Jacobs <[email protected]>")
8586
.about("path-normalization pentesting tool")
8687
.arg(
@@ -402,7 +403,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
402403
let brute_wordlist = wordlist.clone();
403404
let worker_results: Vec<_> = workers.collect().await;
404405
let mut results: Vec<String> = vec![];
405-
let mut brute_results: Vec<String> = vec![];
406+
let mut brute_results: HashMap<String, String> = HashMap::new();
406407
for result in worker_results {
407408
let result = match result {
408409
Ok(result) => result,
@@ -477,9 +478,10 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
477478
Ok(result) => result,
478479
Err(_) => continue,
479480
};
481+
let content_length = result.rs.clone();
480482
let result_data = result.data.clone();
481483
if result.data.is_empty() == false {
482-
brute_results.push(result_data);
484+
brute_results.insert(result_data, content_length);
483485
}
484486
}
485487

@@ -490,7 +492,13 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
490492
println!("{}", "Discovered:".bold().green());
491493
println!("{}", "===========".bold().green());
492494
for result in brute_results {
493-
println!("{} {}", "::".bold().green(), result.bold().white());
495+
println!(
496+
"{} {} {} {}",
497+
"::".bold().green(),
498+
result.0.bold().white(),
499+
"::".bold().green(),
500+
result.1.bold().white()
501+
);
494502
}
495503

496504
let elapsed_time = now.elapsed();

0 commit comments

Comments
 (0)