added the ability to parse cidr notation for target inputs.
This commit is contained in:
1 parent
0ef453427b
commit
eae2e5a43b
3 files changed
+19
-1
No files matched your search
Generated
+7
@@ -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",
|
||||
]
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
+11
-1
@@ -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::<IpAddr>() {
|
||||
computers.push(target.trim().to_string());
|
||||
} else if let Ok(net) = target.trim().parse::<ipnet::IpNet>() {
|
||||
net.hosts().into_iter().for_each(|h| {
|
||||
computers.push(h.to_string());
|
||||
});
|
||||
} else {
|
||||
computers.push(target.trim().to_lowercase());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
computers.push(targets);
|
||||
|
||||
Reference in new issue
Block a user