(subnet, local_ip=None, exclude_self=False, exclude_targets=None, timing="T4")
| 454 | score = 0 |
| 455 | if "nmap_ping" in sources: |
| 456 | score += 65 |
| 457 | if "arp" in sources: |
| 458 | score += 20 |
| 459 | if "ip_neigh" in sources: |
| 460 | score += 20 |
| 461 | if mac: |
| 462 | score += 10 |
| 463 | return min(score, 100) |
| 464 | |
| 465 | |
| 466 | |
| 467 | def discover_hosts(subnet, local_ip=None, exclude_self=False, exclude_targets=None, timing="T4"): |
| 468 | records = {} |
| 469 | |
| 470 | discover_from_proc_arp(records) |
| 471 | discover_from_ip_neigh(records) |
| 472 | |
| 473 | try: |
| 474 | ping_results = discover_from_nmap_ping(subnet, timing=timing, exclude_targets=exclude_targets) |
| 475 | for ip, payload in ping_results.items(): |
| 476 | add_discovery_record(records, ip, "nmap_ping", mac=payload.get("mac", ""), note="Responded to host discovery") |
| 477 | except Exception as exc: |
| 478 | warn(f"Nmap host discovery failed, continuing with ARP/neigh only: {exc}") |
| 479 |
no test coverage detected