Don't scan private IP addresses.

This commit is contained in:
Eduard Tolosa 2023-04-11 23:18:13 -05:00
parent cde33efba1
commit 36419c3da7
2 changed files with 8 additions and 4 deletions

View file

@ -67,7 +67,7 @@ pub fn check_full_path(full_path: &str) -> bool {
pub fn delete_files(paths: &HashSet<String>) {
for file in paths {
if Path::new(&file).exists() {
match std::fs::remove_file(&file) {
match std::fs::remove_file(file) {
Ok(_) => (),
Err(e) => error!("Error deleting the file {}. Description: {}", &file, e),
}

View file

@ -214,11 +214,15 @@ fn parallel_resolver_engine(
.collect();
let mut nmap_ips: HashSet<String> = resolv_data
.iter()
.map(|(_, resolv_data)| resolv_data.ip.clone())
.values()
.map(|resolv_data| resolv_data.ip.clone())
.collect();
nmap_ips.retain(|ip| !ip.is_empty());
nmap_ips.retain(|ip| {
!ip.is_empty()
&& ip.parse::<Ipv4Addr>().is_ok()
&& !ip.parse::<Ipv4Addr>().unwrap().is_private()
});
let nmap_data: HashMap<String, Nmaprun> = nmap_ips
.par_iter()