mirror of
https://github.com/nmap/nmap.git
synced 2025-12-31 03:49:01 +00:00
Make -Pn override all other -P* types
This was a case where order of arguments affected the outcome: if -PE came before -Pn, then -Pn took precedence. Otherwise, -PE took precedence (except that o.pingtype would also contain PINGTYPE_NONE... not sure how that affected things). This cleans things up by letting PINGTYPE_NONE be OR'd into o.opingtype, then checking for it after all options have been processed and clearing out the other types if it is found.
This commit is contained in:
8
nmap.cc
8
nmap.cc
@@ -1145,7 +1145,7 @@ void parse_options(int argc, char **argv) {
|
||||
else if (*optarg == 'P')
|
||||
o.pingtype |= PINGTYPE_ICMP_TS;
|
||||
else if (*optarg == 'n' || *optarg == '0' || *optarg == 'N' || *optarg == 'D')
|
||||
o.pingtype = PINGTYPE_NONE;
|
||||
o.pingtype |= PINGTYPE_NONE;
|
||||
else if (*optarg == 'R')
|
||||
o.pingtype |= PINGTYPE_ARP;
|
||||
else if (*optarg == 'S') {
|
||||
@@ -1272,7 +1272,7 @@ void parse_options(int argc, char **argv) {
|
||||
case 'L':
|
||||
o.listscan = 1;
|
||||
o.noportscan = 1;
|
||||
o.pingtype = PINGTYPE_NONE;
|
||||
o.pingtype |= PINGTYPE_NONE;
|
||||
break;
|
||||
case 'M':
|
||||
o.maimonscan = 1;
|
||||
@@ -1430,6 +1430,10 @@ void apply_delayed_options() {
|
||||
o.os_labels_ipv6 = load_fp_matches();
|
||||
}
|
||||
|
||||
// Must check and change this before validate_scan_lists
|
||||
if (o.pingtype & PINGTYPE_NONE)
|
||||
o.pingtype = PINGTYPE_NONE;
|
||||
|
||||
validate_scan_lists(ports, o);
|
||||
o.ValidateOptions();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user