Discover the path MTU to `target` and flag an MTU black hole (a hop that silently drops full-size packets -- the classic 'ping works, big transfers hang' fault). Uses a `ping -M do` (don't-fragment) binary search: the largest payload that gets through without fragmentation gives the
(target)
| 1130 | seen_mismatch.add(src) |
| 1131 | findings.append({'code': 'eth_arp_src_mismatch', 'severity': 'high', |
| 1132 | 'mac': src, 'claims': e['sender_mac']}) |
| 1133 | reasons.append(f"ARP reply from {src} carries a different sender-hardware " |
| 1134 | f"address {e['sender_mac']} (is-at) than its Ethernet source " |
| 1135 | "— frame forgery / MITM tell") |
| 1136 | bump('spoofed') |
| 1137 | if e['eth_dst'] == 'ff:ff:ff:ff:ff:ff' and src not in seen_bcast: |
| 1138 | seen_bcast.add(src) |
| 1139 | findings.append({'code': 'broadcast_reply_anomaly', 'severity': 'high', |
| 1140 | 'mac': src}) |
| 1141 | reasons.append(f"{src} sent an ARP *reply* to the broadcast address " |
| 1142 | "— unsolicited broadcast reply, a classic poisoning-tool tell") |
| 1143 | bump('spoofed') |
| 1144 | if e['sender_ip'] == '0.0.0.0' and src not in seen_probe: |
| 1145 | seen_probe.add(src) |
| 1146 | findings.append({'code': 'invalid_probe_reply', 'severity': 'medium', |
| 1147 | 'mac': src}) |
| 1148 | reasons.append(f"{src} sent an ARP reply claiming sender IP 0.0.0.0 " |
| 1149 | "— malformed reply to an address-probe") |
| 1150 | bump('suspicious') |
| 1151 | sip = e['sender_ip'] |
| 1152 | try: |
| 1153 | bad = sip and (ipaddress.ip_address(sip).is_multicast or sip == '255.255.255.255') |
| 1154 | except ValueError: |
| 1155 | bad = False |
| 1156 | if bad and src not in seen_badsender: |
| 1157 | seen_badsender.add(src) |
| 1158 | findings.append({'code': 'invalid_sender_ip', 'severity': 'medium', |
| 1159 | 'mac': src, 'sender_ip': sip}) |
| 1160 | reasons.append(f"{src} used ARP sender IP {sip} (multicast/broadcast) " |
| 1161 | "— structurally invalid, spoofing or a broken stack") |
| 1162 | bump('suspicious') |
| 1163 | |
| 1164 | # -- per-source-MAC aggregates -- |
| 1165 | req_count, req_targets = {}, {} |
| 1166 | garp_count, garp_ips = {}, {} |
| 1167 | for e in events: |
| 1168 | src = e['eth_src'] |
| 1169 | if src in exempt: |
| 1170 | continue |
| 1171 | if e['gratuitous']: |
| 1172 | garp_count[src] = garp_count.get(src, 0) + 1 |
| 1173 | garp_ips.setdefault(src, set()).add(e['sender_ip']) |
| 1174 | elif e['op'] == 'request' and e.get('target_ip'): |
| 1175 | req_count[src] = req_count.get(src, 0) + 1 |
| 1176 | req_targets.setdefault(src, set()).add(e['target_ip']) |
| 1177 | |
| 1178 | win = max(1, int(seconds or 1)) |
| 1179 | for src, n in sorted(req_count.items()): |
| 1180 | ntgt = len(req_targets.get(src, ())) |
| 1181 | if ntgt >= _ARP_CAP_REQ_BREADTH: |
| 1182 | findings.append({'code': 'request_breadth_anomaly', 'severity': 'high', |