diff --git a/Cargo.lock b/Cargo.lock index 171cb49..b415c1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -175,6 +175,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + [[package]] name = "is_terminal_polyfill" version = "1.70.2" @@ -241,6 +247,7 @@ dependencies = [ "clap", "colored", "crossbeam", + "ipnet", "rayon", "walkdir", ] diff --git a/Cargo.toml b/Cargo.toml index 3bb6ed0..87f9124 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ edition = "2024" clap = { version = "4.5.41", features = ["derive"] } colored = "3.0.0" crossbeam = "0.8.4" +ipnet = "2.12.2" rayon = "1.12.0" walkdir = "2.5.0" diff --git a/src/main.rs b/src/main.rs index 520130d..e16b06b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,14 @@ use clap::Parser; use colored::Colorize; use crossbeam::queue::SegQueue; +use ipnet::IpNet; use std::fmt::Debug; use std::fs; use std::fs::File; use std::fs::read_to_string; use std::io::Write; use std::io::stdin; +use std::net::IpAddr; use std::path::PathBuf; use std::process::Command; use std::process::exit; @@ -370,7 +372,15 @@ fn main() { if targets.contains(",") { let split_targets: Vec<&str> = targets.split(",").collect(); for target in split_targets { - computers.push(target.trim().to_lowercase()); + if let Ok(_) = target.trim().parse::() { + computers.push(target.trim().to_string()); + } else if let Ok(net) = target.trim().parse::() { + net.hosts().into_iter().for_each(|h| { + computers.push(h.to_string()); + }); + } else { + computers.push(target.trim().to_lowercase()); + } } } else { computers.push(targets);