mirror of
https://github.com/epi052/feroxbuster.git
synced 2026-05-25 23:21:12 -03:00
added --stdin flag; url/stdin mutually exclusive
This commit is contained in:
@@ -66,6 +66,7 @@ extensions = ["php", "html"]
|
||||
headers = {"Accept" = "application/json"}
|
||||
norecursion = true
|
||||
addslash = true
|
||||
stdin = true
|
||||
```
|
||||
|
||||
### Command Line Parsing
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
# extensions = ["php", "html"]
|
||||
# norecursion = true
|
||||
# addslash = true
|
||||
# stdin = true
|
||||
|
||||
|
||||
# headers can be specified on multiple lines or as an inline table
|
||||
|
||||
@@ -61,6 +61,9 @@ pub struct Configuration {
|
||||
pub norecursion: bool,
|
||||
#[serde(default)]
|
||||
pub addslash: bool,
|
||||
#[serde(default)]
|
||||
pub stdin: bool,
|
||||
|
||||
}
|
||||
|
||||
// functions timeout, threads, statuscodes, useragent, and wordlist are used to provide defaults in the
|
||||
@@ -96,6 +99,7 @@ impl Default for Configuration {
|
||||
timeout,
|
||||
useragent,
|
||||
quiet: false,
|
||||
stdin: false,
|
||||
verbosity: 0,
|
||||
addslash: false,
|
||||
insecure: false,
|
||||
@@ -133,6 +137,7 @@ impl Configuration {
|
||||
/// - headers: None
|
||||
/// - norecursion: false (don't recursively bust enumerated sub-directories)
|
||||
/// - addslash: false
|
||||
/// - stdin: false
|
||||
///
|
||||
/// After which, any values defined in a
|
||||
/// [ferox-config.toml](constant.DEFAULT_CONFIG_NAME.html) config file will override the
|
||||
@@ -172,6 +177,7 @@ impl Configuration {
|
||||
config.headers = settings.headers;
|
||||
config.norecursion = settings.norecursion;
|
||||
config.addslash = settings.addslash;
|
||||
config.stdin = settings.stdin;
|
||||
}
|
||||
}
|
||||
None => {}
|
||||
@@ -240,8 +246,12 @@ impl Configuration {
|
||||
config.addslash = args.is_present("addslash");
|
||||
}
|
||||
|
||||
// target_url is required, so no if statement is required
|
||||
config.target_url = String::from(args.value_of("url").unwrap());
|
||||
if args.is_present("stdin") {
|
||||
config.stdin = args.is_present("stdin");
|
||||
}
|
||||
else {
|
||||
config.target_url = String::from(args.value_of("url").unwrap());
|
||||
}
|
||||
|
||||
////
|
||||
// organizational breakpoint; all options below alter the Client configuration
|
||||
@@ -356,6 +366,7 @@ mod tests {
|
||||
headers = {stuff = "things", mostuff = "mothings"}
|
||||
norecursion = true
|
||||
addslash = true
|
||||
stdin = true
|
||||
"#;
|
||||
let tmp_dir = TempDir::new().unwrap();
|
||||
let file = tmp_dir.path().join(DEFAULT_CONFIG_NAME);
|
||||
@@ -375,6 +386,7 @@ mod tests {
|
||||
assert_eq!(config.verbosity, 0);
|
||||
assert_eq!(config.quiet, false);
|
||||
assert_eq!(config.norecursion, false);
|
||||
assert_eq!(config.stdin, false);
|
||||
assert_eq!(config.addslash, false);
|
||||
assert_eq!(config.redirects, false);
|
||||
assert_eq!(config.insecure, false);
|
||||
@@ -448,6 +460,12 @@ mod tests {
|
||||
assert_eq!(config.norecursion, true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_reads_stdin() {
|
||||
let config = setup_config_test();
|
||||
assert_eq!(config.stdin, true);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn config_reads_addslash() {
|
||||
let config = setup_config_test();
|
||||
|
||||
@@ -19,9 +19,9 @@ pub fn initialize() -> App<'static, 'static> {
|
||||
Arg::with_name("url")
|
||||
.short("u")
|
||||
.long("url")
|
||||
.required(true)
|
||||
.required_unless("stdin")
|
||||
.value_name("URL")
|
||||
.help("The target URL (required, unless passing urls on STDIN)"),
|
||||
.help("The target URL (required, unless --stdin used)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("threads")
|
||||
@@ -146,6 +146,14 @@ pub fn initialize() -> App<'static, 'static> {
|
||||
.takes_value(false)
|
||||
.help("Append / to each request")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("stdin")
|
||||
.long("stdin")
|
||||
.takes_value(false)
|
||||
.help("Read url(s) from STDIN")
|
||||
.conflicts_with("url")
|
||||
)
|
||||
|
||||
.after_help(r#"NOTE:
|
||||
Options that take multiple values are very flexible. Consider the following ways of specifying
|
||||
extensions:
|
||||
@@ -162,7 +170,7 @@ EXAMPLES:
|
||||
./feroxbuster -u http://[::1] --norecursion -vv
|
||||
|
||||
Read urls from STDIN; pipe only resulting urls out to another tool
|
||||
cat targets | ./feroxbuster -q -s 200 301 302 --redirects -x js | fff -s 200 -o js-files
|
||||
cat targets | ./feroxbuster --stdin -q -s 200 301 302 --redirects -x js | fff -s 200 -o js-files
|
||||
|
||||
Ludicrous speed... go!
|
||||
./feroxbuster -u http://127.1 -t 200
|
||||
|
||||
Reference in New Issue
Block a user