1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Revert r38129. Pingprobes were not being seen in some cases.

This commit is contained in:
dmiller
2023-11-14 19:04:27 +00:00
parent 6814bc4cdd
commit 4a82148f3f

View File

@@ -895,53 +895,18 @@ void begin_sniffer(UltraScanInfo *USI, std::vector<Target *> &Targets) {
pcap_filter += "))"; pcap_filter += "))";
} }
} else if (USI->tcp_scan || USI->udp_scan || USI->sctp_scan || USI->ping_scan) { } else if (USI->tcp_scan || USI->udp_scan || USI->sctp_scan || USI->ping_scan) {
bool first = false;
pcap_filter = "dst host "; pcap_filter = "dst host ";
pcap_filter += inet_ntop_ez(USI->SourceSockAddr(), sizeof(struct sockaddr_storage)); pcap_filter += inet_ntop_ez(USI->SourceSockAddr(), sizeof(struct sockaddr_storage));
pcap_filter += " and (icmp or icmp6"; pcap_filter += " and (icmp or icmp6 or ";
if (doIndividual) { if (doIndividual) {
pcap_filter += " or ("; pcap_filter += "((";
first = true;
}
if (USI->tcp_scan || (USI->ping_scan && USI->ptech.rawtcpscan)) {
if (!first) {
pcap_filter += " or ";
}
else if (doIndividual) {
pcap_filter += "(";
}
pcap_filter += "tcp";
first = false;
}
if (USI->udp_scan || (USI->ping_scan && USI->ptech.rawudpscan)) {
if (!first) {
pcap_filter += " or ";
}
else if (doIndividual) {
pcap_filter += "(";
}
pcap_filter += "udp";
first = false;
}
if (USI->sctp_scan || (USI->ping_scan && USI->ptech.rawsctpscan)) {
if (!first) {
pcap_filter += " or ";
}
else if (doIndividual) {
pcap_filter += "(";
}
pcap_filter += "sctp";
first = false;
} }
// have to accept all of these because pingprobe could be any, regardless of scan type.
pcap_filter += "tcp or udp or sctp";
if (doIndividual) { if (doIndividual) {
if (!first) { pcap_filter += ") and (";
pcap_filter += ") and (";
}
pcap_filter += dst_hosts; pcap_filter += dst_hosts;
if (!first) { pcap_filter += "))";
pcap_filter += ")";
}
pcap_filter += ")";
} }
pcap_filter += ")"; pcap_filter += ")";
} else { } else {