updated integration tests to use cargo_bin! macro

This commit is contained in:
epi
2025-12-24 05:45:10 -05:00
parent 47b4efdd1b
commit 5bb42c4004
16 changed files with 186 additions and 327 deletions

11
Cargo.lock generated
View File

@@ -116,13 +116,12 @@ dependencies = [
[[package]]
name = "assert_cmd"
version = "2.0.17"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bd389a4b2970a01282ee455294913c0a43724daedcd1a24c3eb0ec1c1320b66"
checksum = "bcbb6924530aa9e0432442af08bbcafdad182db80d2e560da42a6d442535bf85"
dependencies = [
"anstyle",
"bstr",
"doc-comment",
"libc",
"predicates",
"predicates-core",
@@ -790,12 +789,6 @@ dependencies = [
"syn 2.0.104",
]
[[package]]
name = "doc-comment"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "dtoa"
version = "1.0.10"

View File

@@ -69,7 +69,7 @@ self_update = { version = "0.40", features = [
[dev-dependencies]
tempfile = "3.20"
httpmock = "0.7"
assert_cmd = "2.0"
assert_cmd = "2.1"
predicates = "3.1"
[profile.release]

View File

@@ -1,6 +1,8 @@
mod utils;
use assert_cmd::Command;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use predicates::prelude::*;
use std::process::Command;
use utils::{setup_tmp_directory, teardown_tmp_directory};
#[test]
@@ -13,15 +15,13 @@ fn banner_prints_proxy() -> Result<(), Box<dyn std::error::Error>> {
];
let (tmp_dir, file) = setup_tmp_directory(&urls, "wordlist")?;
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("--proxy")
.arg("http://127.0.0.1:8080")
.arg("--wordlist")
.arg("/definitely/doesnt/exist/0cd7fed0-47f4-4b18-a1b0-ac39708c1676")
.pipe_stdin(file)
.unwrap()
.stdin(std::fs::File::open(file)?)
.assert()
.success()
.stderr(
@@ -53,15 +53,13 @@ fn banner_prints_replay_proxy() -> Result<(), Box<dyn std::error::Error>> {
];
let (tmp_dir, file) = setup_tmp_directory(&urls, "wordlist")?;
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("--wordlist")
.arg("/definitely/doesnt/exist/0cd7fed0-47f4-4b18-a1b0-ac39708c1676")
.arg("--replay-proxy")
.arg("http://127.0.0.1:8081")
.pipe_stdin(file)
.unwrap()
.stdin(std::fs::File::open(file)?)
.assert()
.success()
.stderr(
@@ -87,8 +85,7 @@ fn banner_prints_replay_proxy() -> Result<(), Box<dyn std::error::Error>> {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + multiple headers
fn banner_prints_headers() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--headers")
@@ -119,8 +116,7 @@ fn banner_prints_headers() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + multiple dont scan url & regex entries
fn banner_prints_denied_urls() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--dont-scan")
@@ -155,8 +151,7 @@ fn banner_prints_denied_urls() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + multiple scope url entries
fn banner_prints_scope_urls() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--scope")
@@ -188,8 +183,7 @@ fn banner_prints_scope_urls() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + multiple headers
fn banner_prints_random_agent() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--random-agent")
@@ -215,8 +209,7 @@ fn banner_prints_random_agent() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + multiple size filters
fn banner_prints_filter_sizes() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-S")
@@ -261,8 +254,7 @@ fn banner_prints_filter_sizes() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + queries
fn banner_prints_queries() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-Q")
@@ -293,8 +285,7 @@ fn banner_prints_queries() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + status codes
fn banner_prints_status_codes() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-s")
@@ -321,8 +312,7 @@ fn banner_prints_status_codes() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + replay codes
fn banner_prints_replay_codes() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--replay-codes")
@@ -353,8 +343,7 @@ fn banner_prints_replay_codes() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + output file
fn banner_prints_output_file() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--output")
@@ -385,8 +374,7 @@ fn banner_prints_output_file() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + insecure
fn banner_prints_insecure() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-k")
@@ -413,8 +401,7 @@ fn banner_prints_insecure() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + follow redirects
fn banner_prints_redirects() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-r")
@@ -441,8 +428,7 @@ fn banner_prints_redirects() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + extensions
fn banner_prints_extensions() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-x")
@@ -472,8 +458,7 @@ fn banner_prints_extensions() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + dont_filter
fn banner_prints_dont_filter() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--dont-filter")
@@ -500,8 +485,7 @@ fn banner_prints_dont_filter() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + verbosity=1
fn banner_prints_verbosity_one() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-v")
@@ -528,8 +512,7 @@ fn banner_prints_verbosity_one() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + verbosity=2
fn banner_prints_verbosity_two() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-vv")
@@ -556,8 +539,7 @@ fn banner_prints_verbosity_two() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + verbosity=3
fn banner_prints_verbosity_three() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-vvv")
@@ -584,8 +566,7 @@ fn banner_prints_verbosity_three() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + verbosity=4
fn banner_prints_verbosity_four() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-vvvv")
@@ -612,8 +593,7 @@ fn banner_prints_verbosity_four() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + add slash
fn banner_prints_add_slash() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-f")
@@ -640,8 +620,7 @@ fn banner_prints_add_slash() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + INFINITE recursion
fn banner_prints_infinite_depth() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--depth")
@@ -669,8 +648,7 @@ fn banner_prints_infinite_depth() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + recursion depth
fn banner_prints_recursion_depth() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--depth")
@@ -698,8 +676,7 @@ fn banner_prints_recursion_depth() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + server certs
fn banner_prints_server_certs() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--server-certs")
@@ -729,8 +706,7 @@ fn banner_prints_server_certs() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + server certs
fn banner_prints_client_cert_and_key() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--client-cert")
@@ -762,8 +738,7 @@ fn banner_prints_client_cert_and_key() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + no recursion
fn banner_prints_no_recursion() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-n")
@@ -790,8 +765,7 @@ fn banner_prints_no_recursion() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see nothing
fn banner_doesnt_print() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-q")
@@ -808,8 +782,7 @@ fn banner_doesnt_print() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + extract-links
fn banner_prints_extract_links() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-e")
@@ -836,8 +809,7 @@ fn banner_prints_extract_links() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + scan-limit
fn banner_prints_scan_limit() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-L")
@@ -865,8 +837,7 @@ fn banner_prints_scan_limit() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + response-size-limit
fn banner_prints_response_size_limit() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--response-size-limit")
@@ -894,8 +865,7 @@ fn banner_prints_response_size_limit() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + filter-status
fn banner_prints_filter_status() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-C")
@@ -922,8 +892,7 @@ fn banner_prints_filter_status() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + json
fn banner_prints_json() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--json")
@@ -952,8 +921,7 @@ fn banner_prints_json() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + json
fn banner_prints_debug_log() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--debug-log")
@@ -981,8 +949,7 @@ fn banner_prints_debug_log() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + regex filters
fn banner_prints_filter_regex() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--filter-regex")
@@ -1010,8 +977,7 @@ fn banner_prints_filter_regex() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + time limit
fn banner_prints_time_limit() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--time-limit")
@@ -1039,8 +1005,7 @@ fn banner_prints_time_limit() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + similarity filter
fn banner_prints_similarity_filter() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--filter-similar-to")
@@ -1068,8 +1033,7 @@ fn banner_prints_similarity_filter() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + rate limit
fn banner_prints_rate_limit() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--rate-limit")
@@ -1097,8 +1061,7 @@ fn banner_prints_rate_limit() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + auto tune
fn banner_prints_auto_tune() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--auto-tune")
@@ -1125,8 +1088,7 @@ fn banner_prints_auto_tune() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + auto bail
fn banner_prints_auto_bail() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--auto-bail")
@@ -1153,8 +1115,7 @@ fn banner_prints_auto_bail() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see no banner output
fn banner_doesnt_print_when_silent() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--silent")
@@ -1179,8 +1140,7 @@ fn banner_doesnt_print_when_silent() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see no banner output
fn banner_doesnt_print_when_quiet() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--quiet")
@@ -1205,8 +1165,7 @@ fn banner_doesnt_print_when_quiet() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see nothing as --parallel forces --silent to be true
fn banner_prints_parallel() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("--quiet")
.arg("--parallel")
@@ -1231,8 +1190,7 @@ fn banner_prints_parallel() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + methods
fn banner_prints_methods() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-m")
@@ -1262,8 +1220,7 @@ fn banner_prints_methods() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + data body
fn banner_prints_data() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-m")
@@ -1295,8 +1252,7 @@ fn banner_prints_data() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + ignored extensions
fn banner_prints_collect_extensions_and_dont_collect_default() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--collect-extensions")
@@ -1324,8 +1280,7 @@ fn banner_prints_collect_extensions_and_dont_collect_default() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect extensions
fn banner_prints_collect_extensions_and_dont_collect_with_input() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--collect-extensions")
@@ -1356,8 +1311,7 @@ fn banner_prints_collect_extensions_and_dont_collect_with_input() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect backups
fn banner_prints_collect_backups() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--collect-backups")
@@ -1383,8 +1337,7 @@ fn banner_prints_collect_backups() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect words
fn banner_prints_collect_words() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--collect-words")
@@ -1410,8 +1363,7 @@ fn banner_prints_collect_words() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect words
fn banner_prints_all_composite_settings_smart() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--smart")
@@ -1440,8 +1392,7 @@ fn banner_prints_all_composite_settings_smart() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect words
fn banner_prints_all_composite_settings_thorough() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--thorough")
@@ -1470,8 +1421,7 @@ fn banner_prints_all_composite_settings_thorough() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect words
fn banner_prints_all_composite_settings_burp() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--burp")
@@ -1498,8 +1448,7 @@ fn banner_prints_all_composite_settings_burp() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect words
fn banner_prints_all_composite_settings_data_json_stdin() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--data-json")
@@ -1525,8 +1474,7 @@ fn banner_prints_all_composite_settings_data_json_stdin() {
#[test]
fn banner_prints_all_composite_settings_data_json_file() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-m")
@@ -1555,8 +1503,7 @@ fn banner_prints_all_composite_settings_data_json_file() {
#[test]
fn banner_prints_all_composite_settings_data_urlencoded_stdin() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("-m")
@@ -1590,8 +1537,7 @@ fn banner_prints_all_composite_settings_data_urlencoded_stdin() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect words
fn banner_prints_all_composite_settings_data_urlencoded_file() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--data-urlencoded")
@@ -1622,8 +1568,7 @@ fn banner_prints_all_composite_settings_data_urlencoded_file() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + collect words
fn banner_prints_all_composite_settings_burp_replay() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--burp-replay")
@@ -1650,8 +1595,7 @@ fn banner_prints_all_composite_settings_burp_replay() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + force recursion
fn banner_prints_force_recursion() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--force-recursion")
@@ -1677,8 +1621,7 @@ fn banner_prints_force_recursion() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + scan-dir-listings
fn banner_prints_scan_dir_listings() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--scan-dir-listings")
@@ -1704,8 +1647,7 @@ fn banner_prints_scan_dir_listings() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + protocol
fn banner_prints_limit_dirs() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("localhost")
.arg("--limit-bars")
@@ -1732,8 +1674,7 @@ fn banner_prints_limit_dirs() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + force recursion
fn banner_prints_update_app() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--update")
.assert()
.success()
@@ -1744,8 +1685,7 @@ fn banner_prints_update_app() {
/// test allows non-existent wordlist to trigger the banner printing to stderr
/// expect to see all mandatory prints + unique
fn banner_prints_unique() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://localhost")
.arg("--unique")

View File

@@ -1,4 +1,5 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::MockServer;
use predicates::prelude::*;
@@ -12,8 +13,7 @@ fn read_in_config_file_for_settings() -> Result<(), Box<dyn std::error::Error>>
let (tmp_dir, file) = setup_tmp_directory(&["threads = 37".to_string()], "ferox-config.toml")?;
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.current_dir(&tmp_dir)
.arg("--url")
.arg(srv.url("/"))

View File

@@ -1,9 +1,10 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use assert_cmd::Command;
use httpmock::Method::GET;
use httpmock::MockServer;
use predicates::prelude::*;
use std::process::Command;
use utils::{setup_tmp_directory, teardown_tmp_directory};
#[test]
@@ -17,8 +18,7 @@ fn deny_list_works_during_with_a_normal_scan() {
then.status(200).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -54,8 +54,7 @@ fn deny_list_works_during_extraction() {
then.status(200);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -109,8 +108,7 @@ fn deny_list_works_during_recursion() {
.body("this is a test and is more bytes than other ones");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -179,8 +177,7 @@ fn deny_list_works_during_recursion_with_inverted_parents() {
.body("this is a test and is more bytes than other ones");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/js"))
.arg("--wordlist")
@@ -222,8 +219,7 @@ fn deny_list_prevents_regex_that_denies_base_url() {
then.status(200).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -256,8 +252,7 @@ fn deny_list_prevents_url_that_denies_base_url() {
then.status(200).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")

View File

@@ -1,4 +1,5 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::Method::GET;
use httpmock::MockServer;
@@ -25,8 +26,7 @@ fn extractor_finds_absolute_url() -> Result<(), Box<dyn std::error::Error>> {
then.status(200);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -61,8 +61,7 @@ fn extractor_finds_absolute_url_to_different_domain() -> Result<(), Box<dyn std:
.body("\"http://localhost/homepage/assets/img/icons/handshake.svg\"");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -102,8 +101,7 @@ fn extractor_finds_relative_url() -> Result<(), Box<dyn std::error::Error>> {
then.status(200);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -151,8 +149,7 @@ fn extractor_finds_same_relative_url_twice() {
then.status(200);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -194,8 +191,7 @@ fn extractor_finds_filtered_content() -> Result<(), Box<dyn std::error::Error>>
then.status(200).body("im a little teapot");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -266,8 +262,7 @@ fn extractor_finds_robots_txt_links_and_displays_files_or_scans_directories() {
then.status(403);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -341,8 +336,7 @@ fn extractor_finds_robots_txt_links_and_displays_files_non_recursive() {
then.status(404);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -448,8 +442,7 @@ fn extractor_finds_directory_listing_links_and_displays_files() {
then.status(200).body("im a little teapot too"); // 22
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -557,8 +550,7 @@ fn extractor_finds_directory_listing_links_and_displays_files_non_recursive() {
then.status(200).body("im a little teapot too"); // 22
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -613,8 +605,7 @@ fn extractor_recurses_into_403_directories() -> Result<(), Box<dyn std::error::E
then.status(403);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -685,8 +676,7 @@ fn robots_text_extraction_doesnt_run_with_dont_extract_links() {
then.status(404);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")

View File

@@ -1,4 +1,5 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::Method::GET;
use httpmock::MockServer;
@@ -24,8 +25,7 @@ fn filters_status_code_should_filter_response() {
then.status(200).body("this is also a test of some import");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -71,8 +71,7 @@ fn filters_lines_should_filter_response() {
.body("this is also a test of some import\nwith 2 lines, no less");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -117,8 +116,7 @@ fn filters_words_should_filter_response() {
.body("this is also a test of some import\nwith 2 lines, no less");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -163,8 +161,7 @@ fn filters_size_should_filter_response() {
.body("this is also a test of some import\nwith 2 lines, no less");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -222,8 +219,7 @@ fn filters_similar_should_filter_response() {
then.status(200).body(mutated);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -266,8 +262,7 @@ fn collect_backups_should_be_filtered() {
.body("im a backup file, but filtered out because im not 200");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -316,8 +311,7 @@ fn filters_regex_should_filter_response_based_on_headers() {
.body("this is also a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")

View File

@@ -1,9 +1,10 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use assert_cmd::Command;
use httpmock::Method::GET;
use httpmock::{MockServer, Regex};
use predicates::prelude::*;
use std::process::Command;
use utils::{setup_tmp_directory, teardown_tmp_directory};
#[test]
@@ -12,8 +13,7 @@ use utils::{setup_tmp_directory, teardown_tmp_directory};
fn test_single_target_cannot_connect() -> Result<(), Box<dyn std::error::Error>> {
let (tmp_dir, file) = setup_tmp_directory(&["LICENSE".to_string()], "wordlist")?;
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://fjdksafjkdsajfkdsajkfdsajkfsdjkdsfdsafdsafdsajkr3l2ajfdskafdsjk")
.arg("--wordlist")
@@ -37,12 +37,11 @@ fn test_two_targets_cannot_connect() -> Result<(), Box<dyn std::error::Error>> {
let urls = vec![not_real.clone(), not_real];
let (tmp_dir, file) = setup_tmp_directory(&urls, "wordlist")?;
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("--wordlist")
.arg(file.as_os_str())
.pipe_stdin(file)
.stdin(std::fs::File::open(file)?)
.unwrap()
.assert()
.success()
@@ -70,12 +69,11 @@ fn test_one_good_and_one_bad_target_scan_succeeds() -> Result<(), Box<dyn std::e
then.status(200).body("this is a test");
});
let mut cmd = Command::cargo_bin("feroxbuster").unwrap();
cmd.arg("--stdin")
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("--wordlist")
.arg(file.as_os_str())
.pipe_stdin(file)
.stdin(std::fs::File::open(file)?)
.unwrap()
.assert()
.success()
@@ -96,8 +94,7 @@ fn test_one_good_and_one_bad_target_scan_succeeds() -> Result<(), Box<dyn std::e
fn test_single_target_cannot_connect_due_to_ssl_errors() -> Result<(), Box<dyn std::error::Error>> {
let (tmp_dir, file) = setup_tmp_directory(&["LICENSE".to_string()], "wordlist")?;
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("https://expired.badssl.com")
.arg("--wordlist")
@@ -132,13 +129,11 @@ fn test_two_good_targets_scan_succeeds() -> Result<(), Box<dyn std::error::Error
then.status(403).body("this also is a test");
});
let mut cmd = Command::cargo_bin("feroxbuster").unwrap();
cmd.arg("--stdin")
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("--wordlist")
.arg(file.as_os_str())
.pipe_stdin(file)
.unwrap()
.stdin(std::fs::File::open(file)?)
.assert()
.success()
.stdout(
@@ -168,8 +163,7 @@ fn test_static_wildcard_request_found() -> Result<(), Box<dyn std::error::Error>
then.status(200).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -205,8 +199,7 @@ fn heuristics_static_wildcard_request_with_dont_filter() -> Result<(), Box<dyn s
then.status(200).body("this is a test");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -289,8 +282,7 @@ fn heuristics_wildcard_test_with_two_static_wildcards_with_silent_enabled(
.body("this is a testAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -341,8 +333,7 @@ fn heuristics_wildcard_test_that_auto_filtering_403s_still_allows_for_recursion_
then.status(200);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")

View File

@@ -1,9 +1,11 @@
mod utils;
use assert_cmd::Command;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::Method::GET;
use httpmock::{MockServer, Regex};
use predicates::prelude::*;
use std::fs::{read_dir, read_to_string};
use std::process::Command;
use utils::{setup_tmp_directory, teardown_tmp_directory};
#[test]
@@ -16,8 +18,7 @@ fn main_use_root_owned_file_as_wordlist() {
then.status(200).body("this is a test");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -41,8 +42,7 @@ fn main_use_empty_wordlist() -> Result<(), Box<dyn std::error::Error>> {
then.status(200).body("this is a test");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -65,14 +65,12 @@ fn main_use_empty_stdin_targets() -> Result<(), Box<dyn std::error::Error>> {
// get_targets is called before scan, so the empty wordlist shouldn't trigger
// the 'Did not find any words' error
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("--wordlist")
.arg(file.as_os_str())
.arg("-vvv")
.pipe_stdin(file)
.unwrap()
.stdin(std::fs::File::open(file)?)
.assert()
.success()
.stderr(
@@ -106,8 +104,7 @@ fn main_parallel_spawns_children() -> Result<(), Box<dyn std::error::Error>> {
let (tgt_tmp_dir, targets) =
setup_tmp_directory(&[t1.url("/"), t2.url("/"), t3.url("/")], "targets")?;
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.env("RUST_LOG", "trace")
.arg("--stdin")
.arg("--parallel")
@@ -117,8 +114,7 @@ fn main_parallel_spawns_children() -> Result<(), Box<dyn std::error::Error>> {
.arg(outfile.as_os_str())
.arg("--wordlist")
.arg(wordlist.as_os_str())
.pipe_stdin(targets)
.unwrap()
.stdin(std::fs::File::open(targets)?)
.assert()
.success()
.stderr(
@@ -170,8 +166,7 @@ fn main_parallel_creates_output_directory() -> Result<(), Box<dyn std::error::Er
let (tgt_tmp_dir, targets) =
setup_tmp_directory(&[t1.url("/"), t2.url("/"), t3.url("/")], "targets")?;
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("--quiet")
.arg("--parallel")
@@ -180,8 +175,7 @@ fn main_parallel_creates_output_directory() -> Result<(), Box<dyn std::error::Er
.arg(outfile.as_os_str())
.arg("--wordlist")
.arg(wordlist.as_os_str())
.pipe_stdin(targets)
.unwrap()
.stdin(std::fs::File::open(targets)?)
.assert()
.success()
.stderr(
@@ -276,8 +270,7 @@ fn main_download_wordlist_from_url() -> Result<(), Box<dyn std::error::Error>> {
then.status(200);
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.current_dir(&tmp_dir)
.arg("--url")
.arg(srv.url("/"))

View File

@@ -1,5 +1,7 @@
use assert_cmd::Command;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use predicates::prelude::*;
use std::process::Command;
#[test]
/// specify an incorrect param (-fc) with --help after it on the command line
@@ -14,8 +16,7 @@ use predicates::prelude::*;
/// the new behavior we expect to see is to print the long form help message, of which
/// Ludicrous speed... go! is near the bottom of that output, so we can test for that
fn parser_incorrect_param_with_tack_tack_help() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("-fc")
.arg("--help")
.assert()
@@ -36,8 +37,7 @@ fn parser_incorrect_param_with_tack_tack_help() {
/// the new behavior we expect to see is to print the short form help message, of which
/// "[CAUTION] 4 -v's is probably too much" is near the bottom of that output, so we can test for that
fn parser_incorrect_param_with_tack_h() {
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("-fc")
.arg("-h")
.assert()

View File

@@ -1,4 +1,5 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::Method::GET;
use httpmock::MockServer;
@@ -48,8 +49,7 @@ fn auto_bail_cancels_scan_with_403s() {
.body("these guys need to be 403 in order to trigger 90% threshold");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -130,8 +130,7 @@ fn auto_bail_cancels_scan_with_429s() {
.body("these guys need to be 403 in order to trigger 90% threshold");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -213,8 +212,7 @@ fn auto_tune_slows_scan_with_429s() {
let start = Instant::now();
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -277,8 +275,7 @@ fn auto_tune_slows_scan_with_403s() {
let start = Instant::now();
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -342,8 +339,7 @@ fn auto_tune_slows_scan_with_general_errors() {
let start = Instant::now();
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")

View File

@@ -1,10 +1,12 @@
mod utils;
use assert_cmd::Command;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::prelude::*;
use httpmock::MockServer;
use regex::Regex;
use std::fs::{read_to_string, write};
use std::process::Command;
use utils::{setup_tmp_directory, teardown_tmp_directory};
/// Helper to create a test wordlist with controllable patterns
@@ -63,8 +65,7 @@ fn scenario_high_403_rate() {
then.status(403).body("Forbidden");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -124,8 +125,7 @@ fn scenario_high_429_rate() {
then.status(429).body("Too Many Requests");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -191,8 +191,7 @@ fn scenario_recovery_pattern() {
then.status(403).body("Forbidden");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -267,8 +266,7 @@ fn scenario_mixed_steady_state() {
then.status(429).body("Too Many Requests");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -340,8 +338,7 @@ fn scenario_capped_auto_tune() {
then.status(403).body("Forbidden");
});
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")

View File

@@ -1,4 +1,5 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::Method::GET;
use httpmock::MockServer;
@@ -19,8 +20,7 @@ fn response_size_limit_small_response_not_truncated() {
then.status(200).body(small_body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -55,8 +55,7 @@ fn response_size_limit_large_response_truncated() {
then.status(200).body(&large_body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -109,8 +108,7 @@ fn response_size_limit_mixed_response_sizes() {
then.status(200).body(&large_body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -173,8 +171,7 @@ fn response_size_limit_default_4mb() {
then.status(200).body(&body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -206,8 +203,7 @@ fn response_size_limit_very_small_limit() {
then.status(200).body(body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -242,8 +238,7 @@ fn response_size_limit_with_redirects() {
.body(&large_redirect_body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -281,8 +276,7 @@ fn response_size_limit_with_error_responses() {
then.status(500).body(&large_error_body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -318,8 +312,7 @@ fn response_size_limit_json_output_includes_truncated_field() {
then.status(200).body(&large_body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -350,8 +343,7 @@ fn response_size_limit_json_output_includes_truncated_field() {
fn response_size_limit_shows_in_banner() {
let (tmp_dir, file) = setup_tmp_directory(&["test".to_string()], "wordlist").unwrap();
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg("http://127.0.0.1:1") // Non-existent server to trigger quick exit
.arg("--wordlist")
@@ -385,8 +377,7 @@ fn response_size_limit_exact_limit() {
then.status(200).body(&exact_body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -425,8 +416,7 @@ fn response_size_limit_from_config_file() {
then.status(200).body(&large_body);
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.current_dir(tmp_dir.path())
.arg("--url")
.arg(srv.url("/"))

View File

@@ -1,10 +1,12 @@
mod utils;
use assert_cmd::Command;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::Method::GET;
use httpmock::MockServer;
use predicates::prelude::*;
use std::fs::{read_to_string, write};
use std::path::Path;
use std::process::Command;
use std::time;
use utils::{setup_tmp_directory, teardown_tmp_directory};
@@ -67,8 +69,7 @@ fn resume_scan_works() {
let (tmp_dir2, state_file) = setup_tmp_directory(&[state_file_contents], "state-file").unwrap();
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("-vvv")
.arg("--resume-from")
.arg(state_file.as_os_str())
@@ -115,16 +116,14 @@ fn time_limit_enforced_when_specified() {
let lower_bound = time::Duration::new(5, 0);
let upper_bound = time::Duration::new(6, 0);
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--stdin")
.arg("-vv")
.arg("--wordlist")
.arg(file.as_os_str())
.arg("--time-limit")
.arg("5s")
.pipe_stdin(targets)
.unwrap()
.stdin(std::fs::File::open(targets).unwrap())
.assert()
.failure();

View File

@@ -1,4 +1,5 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::Method::GET;
use httpmock::MockServer;
@@ -19,8 +20,7 @@ fn scanner_single_request_scan() -> Result<(), Box<dyn std::error::Error>> {
then.status(200).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -72,8 +72,7 @@ fn scanner_recursive_request_scan() -> Result<(), Box<dyn std::error::Error>> {
.body("this is a test and is more bytes than other ones");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -135,8 +134,7 @@ fn scanner_recursive_request_scan_using_only_success_responses(
.body("this is a test and is more bytes than other ones");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -178,8 +176,7 @@ fn scanner_single_request_scan_with_file_output() -> Result<(), Box<dyn std::err
let outfile = tmp_dir.path().join("output");
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -214,8 +211,7 @@ fn scanner_single_request_scan_with_file_output_and_tack_q(
let outfile = tmp_dir.path().join("output");
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -250,8 +246,7 @@ fn scanner_single_request_scan_with_invalid_file_output() -> Result<(), Box<dyn
let outfile = tmp_dir.path(); // outfile is a directory
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -281,8 +276,7 @@ fn scanner_single_request_quiet_scan() -> Result<(), Box<dyn std::error::Error>>
then.status(200).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -317,8 +311,7 @@ fn scanner_single_request_returns_301_without_location_header(
then.status(301).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -358,8 +351,7 @@ fn scanner_single_request_replayed_to_proxy() -> Result<(), Box<dyn std::error::
then.status(200).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -402,8 +394,7 @@ fn scanner_single_request_scan_with_filtered_result() -> Result<(), Box<dyn std:
then.status(200).body("this is a test");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -443,8 +434,7 @@ fn scanner_single_request_scan_with_debug_logging() {
let outfile = tmp_dir.path().join("debug.log");
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -481,8 +471,7 @@ fn scanner_single_request_scan_with_debug_logging_as_json() {
let outfile = tmp_dir.path().join("debug.log");
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -530,8 +519,7 @@ fn scanner_single_request_scan_with_regex_filtered_result() {
.body("this is a test\nThat rug really tied the room together");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -578,8 +566,7 @@ fn scanner_recursion_works_with_403_directories() {
.body("this is a test\nThat rug really tied the room together");
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -628,8 +615,7 @@ fn rate_limit_enforced_when_specified() {
let now = time::Instant::now();
let lower_bound = time::Duration::new(5, 0);
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -665,8 +651,7 @@ fn add_discovered_extension_updates_bars_and_stats() {
assert!(!file_path.exists());
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -735,8 +720,7 @@ fn collect_backups_makes_appropriate_requests() {
})
.collect();
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--collect-backups")
@@ -831,8 +815,7 @@ fn collect_words_makes_appropriate_requests() {
})
.collect();
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("-vv")
@@ -890,8 +873,7 @@ fn scanner_forced_recursion_ignores_normal_redirect_logic() -> Result<(), Box<dy
let outfile = tmp_dir.path().join("output");
Command::cargo_bin("feroxbuster")
.unwrap()
Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")

View File

@@ -1,4 +1,5 @@
mod utils;
use assert_cmd::cargo_bin;
use assert_cmd::prelude::*;
use httpmock::Method::GET;
use httpmock::MockServer;
@@ -26,8 +27,7 @@ fn word_and_status_makes_a_response_unique_and_isnt_seen() -> Result<(), Box<dyn
.body(srv.url("this is a word count supplier"));
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")
@@ -69,8 +69,7 @@ fn bytes_and_status_makes_a_redirect_response_unique_and_isnt_seen(
.body(srv.url("this is a word count supplier")); // redirect + same body
});
let cmd = Command::cargo_bin("feroxbuster")
.unwrap()
let cmd = Command::new(cargo_bin!("feroxbuster"))
.arg("--url")
.arg(srv.url("/"))
.arg("--wordlist")