use ipnetwork::IpNetwork;
#[tokio::main]
async fn main() {
let subnet: IpNetwork = std::env::args()
.nth(1)
.unwrap_or_else(|| "192.168.1.0/24".to_string())
.parse()
.expect("Invalid subnet (use CIDR notation, e.g. 192.168.1.0/24)");
println!("ARP scanning {subnet}...");
let hosts = rullama_network::lan::arp_scan(subnet).await;
if hosts.is_empty() {
println!("No hosts discovered. (Note: requires CAP_NET_RAW / root)");
} else {
println!("Discovered {} host(s):", hosts.len());
for h in &hosts {
println!(" {} mac={:?} hostname={:?}", h.ip, h.mac, h.hostname);
}
}
}