From 2751bb844af55e22e6de82a9d4ad935e95ac8953 Mon Sep 17 00:00:00 2001 From: epi Date: Fri, 9 Oct 2020 13:07:38 -0500 Subject: [PATCH] added dontfilter test and removed dead code --- src/scanner.rs | 7 +------ tests/test_heuristics.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/scanner.rs b/src/scanner.rs index 06d28a0..cbaccbb 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -521,12 +521,7 @@ pub async fn scan_url(target_url: &str, wordlist: Arc>, 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()), }; diff --git a/tests/test_heuristics.rs b/tests/test_heuristics.rs index 6f8b0cc..9cb9b99 100644 --- a/tests/test_heuristics.rs +++ b/tests/test_heuristics.rs @@ -179,3 +179,31 @@ fn test_dynamic_wildcard_request_found() -> Result<(), Box Result<(), Box> { + 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(()) +}