Skip to content

Commit

Permalink
Added default value for Match Code
Browse files Browse the repository at this point in the history
  • Loading branch information
iustin24 committed Sep 14, 2022
1 parent ddbe11b commit 0082142
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct Args {
#[clap(
short = 'i',
long = "include tech",
help = "Technology to be included, even if its not detected by wappalyzer. ( -i PHP,ISS )"
help = "Technology to be included, even if its not detected by wappalyzer. ( -i PHP,IIS )"
)]
pub(crate) techs: Option<String>,

Expand All @@ -99,10 +99,9 @@ pub struct Args {
help = "Filter HTTP status codes from response - Comma separated list",
multiple = true,
use_value_delimiter = true,
value_delimiter = ',',
default_value = "404"
value_delimiter = ','
)]
pub(crate) filtercode: Vec<u16>,
pub(crate) filtercode: Option<Vec<u16>>,

#[clap(
short = 's',
Expand All @@ -120,9 +119,10 @@ pub struct Args {
help = "Match HTTP status codes from response - Comma separated list",
multiple = true,
use_value_delimiter = true,
value_delimiter = ','
value_delimiter = ',',
default_value = "200,204,301,302,307,401,403,405"
)]
pub(crate) matchcode: Option<Vec<u16>>,
pub(crate) matchcode: Vec<u16>,

#[clap(
short = 'U',
Expand Down
28 changes: 14 additions & 14 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) async fn http(paths: HashSet<String>, args: &Args, url: &String) {
)
.unwrap();

let bar_inc = RequestProcessor::new(|request, _action, _state| {
let bar_inc = RequestProcessor::new(|_request, _action, _state| {
bar.inc(1);
});
let response_observer: ResponseObserver<AsyncResponse> = ResponseObserver::new();
Expand All @@ -67,28 +67,28 @@ pub(crate) async fn http(paths: HashSet<String>, args: &Args, url: &String) {
});

let match_decider = FilterDecider::new(args, |args, code, length, _state| {
match match &args.matchcode {
Some(mc) => filter(mc, &code, true),
_ => Action::Keep,
} {
match filter(&args.matchcode, &code, true) {
Action::Keep => match &args.matchsize {
Some(ms) => filter(ms, &length, true),
Some(fs) => filter(fs, &length, true),
_ => Action::Keep,
},
Action::Discard => Action::Discard,
_ => Action::Discard,
}
});

let filter_decider =
FilterDecider::new(args, |args, code, length, _state| {
match filter(&args.filtercode, &code, false) {
Action::Keep => match &args.filtersize {
Some(fs) => filter(fs, &length, false),
_ => Action::Keep,
},
_ => Action::Discard,
}
match match &args.filtercode {
Some(mc) => filter(mc, &code, false),
_ => Action::Keep,
} {
Action::Keep => match &args.filtersize {
Some(ms) => filter(ms, &length, false),
_ => Action::Keep,
},
Action::Discard => Action::Discard,
_ => Action::Discard,
}
});

let response_printer = ResponseProcessor::new(
Expand Down

0 comments on commit 0082142

Please sign in to comment.