mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Ensure all UDP payloads get sent before giving up on a port.
This commit is contained in:
14
payload.cc
14
payload.cc
@@ -363,3 +363,17 @@ const char *get_udp_payload(u16 dport, size_t *length, u8 tryno) {
|
|||||||
return udp_port2payload(dport, length, tryno);
|
return udp_port2payload(dport, length, tryno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t udp_payload_count(u16 dport) {
|
||||||
|
std::map<struct proto_dport, std::vector<struct payload> >::iterator portPayloadIterator;
|
||||||
|
proto_dport key(IPPROTO_UDP, dport);
|
||||||
|
size_t portPayloadVectorSize = 0;
|
||||||
|
|
||||||
|
portPayloadIterator = portPayloads.find(key);
|
||||||
|
|
||||||
|
if (portPayloadIterator != portPayloads.end()) {
|
||||||
|
portPayloadVectorSize = portPayloadIterator->second.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
return portPayloadVectorSize;
|
||||||
|
}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
|
|
||||||
const char *get_udp_payload(u16 dport, size_t *length, u8 tryno);
|
const char *get_udp_payload(u16 dport, size_t *length, u8 tryno);
|
||||||
const char *udp_port2payload(u16 dport, size_t *length, u8 tryno);
|
const char *udp_port2payload(u16 dport, size_t *length, u8 tryno);
|
||||||
|
size_t udp_payload_count(u16 dport);
|
||||||
int init_payloads(void);
|
int init_payloads(void);
|
||||||
|
|
||||||
#endif /* PAYLOAD_H */
|
#endif /* PAYLOAD_H */
|
||||||
|
|||||||
@@ -2454,7 +2454,12 @@ static void doAnyOutstandingRetransmits(UltraScanInfo *USI) {
|
|||||||
probeI--;
|
probeI--;
|
||||||
probe = *probeI;
|
probe = *probeI;
|
||||||
if (probe->timedout && !probe->retransmitted &&
|
if (probe->timedout && !probe->retransmitted &&
|
||||||
maxtries > probe->tryno && !probe->isPing()) {
|
(maxtries > probe->tryno ||
|
||||||
|
// We may exceed maxtries if this is UDP...
|
||||||
|
((USI->udp_scan || (USI->ping_scan && USI->ptech.rawudpscan))
|
||||||
|
// ...and there are more payloads we haven't tried.
|
||||||
|
&& udp_payload_count(probe->dport()) > probe->tryno)
|
||||||
|
) && !probe->isPing()) {
|
||||||
/* For rate limit detection, we delay the first time a new tryno
|
/* For rate limit detection, we delay the first time a new tryno
|
||||||
is seen, as long as we are scanning at least 2 ports */
|
is seen, as long as we are scanning at least 2 ports */
|
||||||
if (probe->tryno + 1 > (int) host->rld.max_tryno_sent &&
|
if (probe->tryno + 1 > (int) host->rld.max_tryno_sent &&
|
||||||
|
|||||||
Reference in New Issue
Block a user