mirror of
https://github.com/nmap/nmap.git
synced 2025-12-25 00:49:01 +00:00
@@ -865,7 +865,8 @@ static void set_default_port_state(std::vector<Target *> &targets, stype scantyp
|
||||
(*target)->ports.setDefaultPortState(IPPROTO_TCP, PORT_OPENFILTERED);
|
||||
break;
|
||||
case UDP_SCAN:
|
||||
(*target)->ports.setDefaultPortState(IPPROTO_UDP, PORT_OPENFILTERED);
|
||||
(*target)->ports.setDefaultPortState(IPPROTO_UDP,
|
||||
o.defeat_icmp_ratelimit ? PORT_CLOSEDFILTERED : PORT_OPENFILTERED);
|
||||
break;
|
||||
case IPPROT_SCAN:
|
||||
(*target)->ports.setDefaultPortState(IPPROTO_IP, PORT_OPENFILTERED);
|
||||
@@ -2125,6 +2126,25 @@ void ultrascan_port_probe_update(UltraScanInfo *USI, HostScanStats *hss,
|
||||
adjust_timing = false;
|
||||
adjust_ping = false;
|
||||
}
|
||||
/* Do not slow down if
|
||||
1) we are in --defeat-icmp-ratelimit mode
|
||||
2) the new state is closed or filtered
|
||||
3) this is a UDP scan
|
||||
We don't want to adjust timing when we get ICMP response, as the host might
|
||||
be ratelimiting them. E.g. the port is actually closed, but the host ratelimiting
|
||||
ICMP responses so we had to retransmit the probe several times in order to
|
||||
match the (slow) rate limit that the target is using for responses. We
|
||||
do not want to waste time on such ports.
|
||||
On the other hand if the port is detected to be open it is a good idea to
|
||||
adjust timing as we could have done retransmissions due to conjested network */
|
||||
if (rcvdtime != NULL
|
||||
&& o.defeat_icmp_ratelimit
|
||||
&& (newstate == PORT_CLOSED || newstate == PORT_FILTERED)
|
||||
&& USI->udp_scan) {
|
||||
if (probe->tryno > 0)
|
||||
adjust_timing = false;
|
||||
adjust_ping = false;
|
||||
}
|
||||
|
||||
if (adjust_timing) {
|
||||
ultrascan_adjust_timing(USI, hss, probe, rcvdtime);
|
||||
|
||||
Reference in New Issue
Block a user