fn deny_list_prevents_regex_that_denies_base_url() {
    let srv = MockServer::start();
    let (tmp_dir, file) = setup_tmp_directory(&["LICENSE".to_string()], "wordlist").unwrap();

    let mock = srv.mock(|when, then| {
        when.method(GET).path("/LICENSE");
        then.status(200).body("this is a test");
    });

    let cmd = Command::cargo_bin("feroxbuster")
        .unwrap()
        .arg("--url")
        .arg(srv.url("/"))
        .arg("--wordlist")
        .arg(file.as_os_str())
        .arg("--dont-scan")
        .arg("/")
        .unwrap();

    teardown_tmp_directory(tmp_dir);

    let err_msg = format!(
        "Could not determine initial targets: The regex '/' matches {}/; the scan will never start",
        srv.base_url()
    );
    cmd.assert()
        .success()
        .stderr(predicate::str::contains(err_msg));

    assert_eq!(mock.hits(), 0);
}
/// test that a regex that prevents the base url from being scanned results in an early exit
test that a regex that prevents the base url from being scanned results in an early exit
test that a regex that prevents the base url from being scanned results in an early exit
fn deny_list_prevents_regex_that_denies_base_url() {
    let srv = MockServer::start();
    let (tmp_dir, file) = setup_tmp_directory(&["LICENSE".to_string()], "wordlist").unwrap();
    let mock = srv.mock(|when, then| {
        when.method(GET).path("/LICENSE");
        then.status(200).body("this is a test");
    });
    let cmd = Command::cargo_bin("feroxbuster")
        .unwrap()
        .arg("--url")
        .arg(srv.url("/"))
        .arg("--wordlist")
        .arg(file.as_os_str())
        .arg("--dont-scan")
        .arg("/")
        .unwrap();
    teardown_tmp_directory(tmp_dir);
    let err_msg = format!(
        "Could not determine initial targets: The regex '/' matches {}/; the scan will never start",
        srv.base_url()
    );
    cmd.assert()
        .success()
        .stderr(predicate::str::contains(err_msg));
    assert_eq!(mock.hits(), 0);
}
fn deny_list_prevents_regex_that_denies_base_url ( ) { let srv = MockServer :: start ( ) ; let ( tmp_dir , file ) = setup_tmp_directory ( & [ " " . to_string ( ) ] , " " ) . unwrap ( ) ; let mock = srv . mock ( | when , then | { when . method ( GET ) . path ( " " ) ; then . status ( 200 ) . body ( " " ) ; } ) ; let cmd = Command :: cargo_bin ( " " ) . unwrap ( ) . arg ( " " ) . arg ( srv . url ( " " ) ) . arg ( " " ) . arg ( file . as_os_str ( ) ) . arg ( " " ) . arg ( " " ) . unwrap ( ) ; teardown_tmp_directory ( tmp_dir ) ; let err_msg = format ! ( " " srv base_url ( ) ) ; cmd . assert ( ) . success ( ) . stderr ( predicate :: str :: contains ( err_msg ) ) ; assert_eq ! ( mock hits ( ) 0 ) ; }
test that a regex that prevents the base url from being scanned results in an early exit
test that a regex that prevents the base url from being scanned results in an early exit