mirror of
https://github.com/epi052/feroxbuster.git
synced 2026-05-30 19:41:12 -03:00
added dontfilter test and removed dead code
This commit is contained in:
@@ -521,12 +521,7 @@ pub async fn scan_url(target_url: &str, wordlist: Arc<HashSet<String>>, base_dep
|
||||
|
||||
let filter = match heuristics::wildcard_test(&target_url, wildcard_bar).await {
|
||||
Some(f) => {
|
||||
if CONFIGURATION.dontfilter {
|
||||
// don't auto filter, i.e. use the defaults
|
||||
Arc::new(WildcardFilter::default())
|
||||
} else {
|
||||
Arc::new(f)
|
||||
}
|
||||
Arc::new(f)
|
||||
}
|
||||
None => Arc::new(WildcardFilter::default()),
|
||||
};
|
||||
|
||||
@@ -179,3 +179,31 @@ fn test_dynamic_wildcard_request_found() -> Result<(), Box<dyn std::error::Error
|
||||
assert_eq!(mock2.times_called(), 1);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// uses dontfilter, so the normal wildcard test should never happen
|
||||
fn heuristics_static_wildcard_request_with_dontfilter() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let srv = MockServer::start();
|
||||
let (tmp_dir, file) = setup_tmp_directory(&["LICENSE".to_string()], "wordlist")?;
|
||||
|
||||
let mock = Mock::new()
|
||||
.expect_method(GET)
|
||||
.expect_path_matches(Regex::new("/[a-zA-Z0-9]{32}/").unwrap())
|
||||
.return_status(200)
|
||||
.return_body("this is a test")
|
||||
.create_on(&srv);
|
||||
|
||||
Command::cargo_bin("feroxbuster")
|
||||
.unwrap()
|
||||
.arg("--url")
|
||||
.arg(srv.url("/"))
|
||||
.arg("--wordlist")
|
||||
.arg(file.as_os_str())
|
||||
.arg("--dontfilter")
|
||||
.unwrap();
|
||||
|
||||
teardown_tmp_directory(tmp_dir);
|
||||
|
||||
assert_eq!(mock.times_called(), 0);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user