mirror of
https://github.com/epi052/feroxbuster.git
synced 2026-04-19 14:51:12 -03:00
fixed #716; wordlist entries with leading slash are trimmed
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -44,9 +44,10 @@ lazy_static! {
|
||||
static ref PARALLEL_LIMITER: Semaphore = Semaphore::new(0);
|
||||
}
|
||||
|
||||
/// Create a HashSet of Strings from the given wordlist then stores it inside an Arc
|
||||
/// Create a Vec of Strings from the given wordlist then stores it inside an Arc
|
||||
fn get_unique_words_from_wordlist(path: &str) -> Result<Arc<Vec<String>>> {
|
||||
log::trace!("enter: get_unique_words_from_wordlist({})", path);
|
||||
let mut trimmed_word = false;
|
||||
|
||||
let file = File::open(path).with_context(|| format!("Could not open {}", path))?;
|
||||
|
||||
@@ -61,12 +62,21 @@ fn get_unique_words_from_wordlist(path: &str) -> Result<Arc<Vec<String>>> {
|
||||
for line in reader.lines() {
|
||||
line.map(|result| {
|
||||
if !result.starts_with('#') && !result.is_empty() {
|
||||
words.push(result);
|
||||
if result.starts_with('/') {
|
||||
words.push(result.trim_start_matches('/').to_string());
|
||||
trimmed_word = true;
|
||||
} else {
|
||||
words.push(result);
|
||||
}
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
|
||||
if trimmed_word {
|
||||
log::warn!("Some words in the wordlist started with a leading forward-slash; those words were trimmed (i.e. /word -> word)");
|
||||
}
|
||||
|
||||
log::trace!(
|
||||
"exit: get_unique_words_from_wordlist -> Arc<wordlist[{} words...]>",
|
||||
words.len()
|
||||
|
||||
Reference in New Issue
Block a user