Skip to content

Commit

Permalink
fix: zero chunk size error when filtered wordlist was very small
Browse files Browse the repository at this point in the history
  • Loading branch information
cestef committed Oct 9, 2024
1 parent ccacc53 commit 09e12e3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,6 @@ pub async fn _main(opts: Opts) -> Result<Tree<TreeData>> {
// Parse wordlists into a HashMap associating each wordlist key to its contents
let mut words = runner::wordlists::parse(&opts.wordlists).await?;

// Get the number of threads to use, default to 10 times the number of cores
let threads = opts
.threads
.unwrap_or(num_cpus::get() * 10)
.max(1)
.min(words.iter().fold(0, |acc, (_, v)| acc + v.words.len()));

let mut url = opts.url.clone().unwrap();

// Check if the URL contains any of the replace keywords
Expand Down Expand Up @@ -192,6 +185,13 @@ pub async fn _main(opts: Opts) -> Result<Tree<TreeData>> {

runner::wordlists::deduplicate(&mut words);

// Get the number of threads to use, default to 10 times the number of cores
let threads = opts
.threads
.unwrap_or(num_cpus::get() * 10)
.max(1)
.min(words.iter().fold(0, |acc, (_, v)| acc + v.words.len()));

if !opts.quiet {
println!(
"{}",
Expand All @@ -206,7 +206,7 @@ pub async fn _main(opts: Opts) -> Result<Tree<TreeData>> {
before.to_string().bold().blue(),
after.to_string().bold().blue(),
((before - after) as f64 / before as f64 * 100.0)
.round()
.trunc()
.to_string()
.bold()
.green()
Expand Down

0 comments on commit 09e12e3

Please sign in to comment.