From ba96b686ea77cd9b09bb7bb3b40233a0288b6d5c Mon Sep 17 00:00:00 2001 From: godylockz <81207744+godylockz@users.noreply.github.com> Date: Sun, 16 Jan 2022 21:15:04 -0500 Subject: [PATCH] Remove iis heuristic, fix test cases --- src/extractor/container.rs | 3 +-- tests/test_extractor.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/extractor/container.rs b/src/extractor/container.rs index 0d44ca7..d9d05e0 100644 --- a/src/extractor/container.rs +++ b/src/extractor/container.rs @@ -413,14 +413,13 @@ impl<'a> Extractor<'a> { // Index of /: apache // Directory Listing for /: tomcat, // Directory Listing -- /: ASP.NET - // - /: iis, azure + // - /: iis, azure, skipping due to loose heuristic let title_selector = Selector::parse("title").unwrap(); for t in html.select(&title_selector) { let title = t.inner_html().to_lowercase(); if title.contains("directory listing for /") || title.contains("index of /") || title.contains("directory listing -- /") - || title.contains(&format!("{} - /", url.host_str().unwrap().to_lowercase())) { log::debug!("Directory listing heuristic detection from \"{}\"", title); let msg = format!( diff --git a/tests/test_extractor.rs b/tests/test_extractor.rs index bea4685..dc70d59 100644 --- a/tests/test_extractor.rs +++ b/tests/test_extractor.rs @@ -466,7 +466,7 @@ fn extractor_finds_directory_listing_links_and_displays_files() { .and(predicate::str::contains("22c")) .and(predicate::str::contains("/misc/LICENSE")) .and(predicate::str::contains("29c")) - .and(predicate::str::contains("200").count(3)), + .and(predicate::str::contains("200").count(5)), ); assert_eq!(mock_root.hits(), 2); @@ -577,7 +577,7 @@ fn extractor_finds_directory_listing_links_and_displays_files_non_recursive() { .not() .and(predicate::str::contains("/misc/LICENSE").not()) .and(predicate::str::contains("29c").not()) - .and(predicate::str::contains("200").count(1)), + .and(predicate::str::contains("200").count(2)), ); assert_eq!(mock_root.hits(), 2);