Skip to content

Commit

Permalink
Don't scan private IP addresses.
Browse files Browse the repository at this point in the history
  • Loading branch information
Edu4rdSHL committed Apr 12, 2023
1 parent cde33ef commit 36419c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
10 changes: 7 additions & 3 deletions src/resolver_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 36419c3

Please # to comment.