MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / discover_hosts

Function discover_hosts

Scripts/Developer Base/Devices Finder.py:456–476  ·  view source on GitHub ↗
(subnet, local_ip=None, exclude_self=False, exclude_targets=None, timing="T4")

Source from the content-addressed store, hash-verified

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
467def 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

Callers 1

scan_networkFunction · 0.70

Calls 8

discover_from_proc_arpFunction · 0.70
discover_from_ip_neighFunction · 0.70
discover_from_nmap_pingFunction · 0.70
add_discovery_recordFunction · 0.70
warnFunction · 0.70
lookup_mac_vendorFunction · 0.70
host_sort_keyFunction · 0.70

Tested by

no test coverage detected