diff --git a/src/args.rs b/src/args.rs index fe8b152..fd02905 100644 --- a/src/args.rs +++ b/src/args.rs @@ -59,6 +59,7 @@ pub fn get_args() -> Args { custom_resolvers: matches.is_present("custom-resolvers"), custom_ports_range: matches.is_present("initial-port") || matches.is_present("last-port"), fast_scan: matches.is_present("fast-scan"), + keep_nmap_logs: matches.is_present("keep-nmap-logs"), files: return_matches_vec(&matches, "files"), min_rate: value_t!(matches, "min-rate", usize).unwrap_or_else(|_| 30000), resolvers: if matches.is_present("custom-resolvers") { diff --git a/src/cli.yml b/src/cli.yml index 95609c3..26b2c79 100644 --- a/src/cli.yml +++ b/src/cli.yml @@ -82,3 +82,10 @@ args: long: logs-dir takes_value: true multiple: false + + - keep-nmap-logs: + help: Keep Nmap XML files created in the logs/ folder for every scanned IP. This data will be usefull for other tasks. + short: k + long: keep-nmap-logs + takes_value: false + multiple: false diff --git a/src/resolver_engine.rs b/src/resolver_engine.rs index eb84e93..c0c854a 100644 --- a/src/resolver_engine.rs +++ b/src/resolver_engine.rs @@ -190,12 +190,9 @@ fn async_resolver_engine(args: &Args, targets: HashSet) -> HashMap (), - Err(e) => { - error!("Error removing filename {}. Description: {}", &filename, e) - } - }; + if !args.keep_nmap_logs && std::fs::remove_file(&filename).is_err() { + error!("Error removing filename {}.", &filename) + } (ip.clone(), nmap_data) } Err(e) => { diff --git a/src/structs.rs b/src/structs.rs index ff2ca0b..feba6ff 100644 --- a/src/structs.rs +++ b/src/structs.rs @@ -19,6 +19,7 @@ pub struct Args { pub quiet_flag: bool, pub custom_resolvers: bool, pub custom_ports_range: bool, + pub keep_nmap_logs: bool, pub fast_scan: bool, pub files: Vec, pub resolvers: Vec,