mirror of
https://github.com/edu4rdshl/unimap.git
synced 2026-07-17 23:24:49 +00:00
parent
3afaf475d0
commit
8b0c7fcb27
5 changed files with 70 additions and 60 deletions
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
|
@ -9,7 +9,7 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug",
|
"name": "Debug",
|
||||||
"program": "${workspaceRoot}/target/debug/${workspaceRootFolderName}",
|
"program": "${workspaceRoot}/target/debug/${workspaceRootFolderName}",
|
||||||
"args": "-f targets.txt -u log.csv --resolvers resolvers.txt --iport 1 --lport 10000 --min-rate 10",
|
"args": "-t useast1.sugarcrm.com --fast-scan",
|
||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
"sourceLanguages": [
|
"sourceLanguages": [
|
||||||
"rust"
|
"rust"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,13 @@ prettytable-rs = "0.8.0"
|
||||||
serde-xml-rs = "0.5.1"
|
serde-xml-rs = "0.5.1"
|
||||||
chrono = "0.4.26"
|
chrono = "0.4.26"
|
||||||
clap = { version = "2.34.0", features = ["yaml"] }
|
clap = { version = "2.34.0", features = ["yaml"] }
|
||||||
config = { version = "0.11.0", features = ["yaml", "json", "toml", "hjson", "ini"] }
|
config = { version = "0.11.0", features = [
|
||||||
|
"yaml",
|
||||||
|
"json",
|
||||||
|
"toml",
|
||||||
|
"hjson",
|
||||||
|
"ini",
|
||||||
|
] }
|
||||||
failure = "0.1.8"
|
failure = "0.1.8"
|
||||||
|
|
||||||
# https://github.com/bluejekyll/trust-dns/pull/1632
|
# https://github.com/bluejekyll/trust-dns/pull/1632
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
extern crate atty;
|
extern crate atty;
|
||||||
#[cfg(feature = "chrono")]
|
|
||||||
extern crate chrono;
|
extern crate chrono;
|
||||||
#[cfg(feature = "colored")]
|
#[cfg(feature = "colored")]
|
||||||
extern crate colored;
|
extern crate colored;
|
||||||
|
|
@ -8,7 +7,6 @@ extern crate log;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
extern crate winapi;
|
extern crate winapi;
|
||||||
|
|
||||||
#[cfg(feature = "chrono")]
|
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
#[cfg(feature = "colored")]
|
#[cfg(feature = "colored")]
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
@ -45,7 +43,6 @@ impl Log for SimpleLogger {
|
||||||
record.level().to_string()
|
record.level().to_string()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#[cfg(feature = "chrono")]
|
|
||||||
{
|
{
|
||||||
print!(
|
print!(
|
||||||
"\n{} [{}] {}",
|
"\n{} [{}] {}",
|
||||||
|
|
@ -54,10 +51,6 @@ impl Log for SimpleLogger {
|
||||||
record.args()
|
record.args()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "chrono"))]
|
|
||||||
{
|
|
||||||
print!("\n[{}] {}", level_string, record.args());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ pub fn validate_target(target: &str) -> bool {
|
||||||
!target.starts_with('.')
|
!target.starts_with('.')
|
||||||
&& target.contains('.')
|
&& target.contains('.')
|
||||||
&& !target.contains(&SPECIAL_CHARS[..])
|
&& !target.contains(&SPECIAL_CHARS[..])
|
||||||
&& target.chars().all(|c| c.is_ascii())
|
&& target.is_ascii()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn null_ip_checker(ip: &str) -> String {
|
pub fn null_ip_checker(ip: &str) -> String {
|
||||||
|
|
|
||||||
|
|
@ -220,15 +220,25 @@ fn parallel_resolver_engine(
|
||||||
|
|
||||||
nmap_ips.retain(|ip| {
|
nmap_ips.retain(|ip| {
|
||||||
!ip.is_empty()
|
!ip.is_empty()
|
||||||
&& ip.parse::<Ipv4Addr>().is_ok()
|
|
||||||
&& !ip.parse::<Ipv4Addr>().unwrap().is_private()
|
&& !ip.parse::<Ipv4Addr>().unwrap().is_private()
|
||||||
|
&& ip.parse::<Ipv4Addr>().is_ok()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if nmap_ips.is_empty() {
|
||||||
|
error!("No valid IPs found for scanning.\n");
|
||||||
|
std::process::exit(1)
|
||||||
|
} else {
|
||||||
let nmap_data: HashMap<String, Nmaprun> = nmap_ips
|
let nmap_data: HashMap<String, Nmaprun> = nmap_ips
|
||||||
.par_iter()
|
.par_iter()
|
||||||
.map(|ip| {
|
.map(|ip| {
|
||||||
let filename = format!("{}/{}.xml", &args.logs_dir, &ip);
|
let filename = format!("{}/{}.xml", &args.logs_dir, &ip);
|
||||||
match nmap::get_nmap_data(&filename, ip, &args.min_rate, &args.ports, args.fast_scan) {
|
match nmap::get_nmap_data(
|
||||||
|
&filename,
|
||||||
|
ip,
|
||||||
|
&args.min_rate,
|
||||||
|
&args.ports,
|
||||||
|
args.fast_scan,
|
||||||
|
) {
|
||||||
Ok(nmap_data) => {
|
Ok(nmap_data) => {
|
||||||
nmap_data
|
nmap_data
|
||||||
.host
|
.host
|
||||||
|
|
@ -281,4 +291,5 @@ fn parallel_resolver_engine(
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue