mirror of
https://github.com/edu4rdshl/unimap.git
synced 2026-07-17 23:24:49 +00:00
Add compatibility with Windows an other OS.
This change adds compatibility with other OS that doesn't have a sudo command. We enabled ports range that was disabled as well.
This commit is contained in:
parent
4438718410
commit
93cbc6a58b
1 changed files with 5 additions and 4 deletions
|
|
@ -116,7 +116,7 @@ pub fn get_nmap_data(
|
|||
last_port: usize,
|
||||
fast_scan: bool,
|
||||
) -> Result<Nmaprun, serde_xml_rs::Error> {
|
||||
let _ports_range = format!("{}-{}", initial_port, last_port);
|
||||
let ports_range = format!("{}-{}", initial_port, last_port);
|
||||
let min_rate = min_rate.to_string();
|
||||
let nmap_args = if fast_scan {
|
||||
vec![
|
||||
|
|
@ -152,7 +152,8 @@ pub fn get_nmap_data(
|
|||
"--min-rate",
|
||||
&min_rate,
|
||||
"-sS",
|
||||
"-p-",
|
||||
"-p",
|
||||
&ports_range,
|
||||
"--open",
|
||||
"-dd",
|
||||
"-T4",
|
||||
|
|
@ -163,12 +164,12 @@ pub fn get_nmap_data(
|
|||
host,
|
||||
]
|
||||
};
|
||||
match Command::new("sudo").args(&nmap_args).output() {
|
||||
match Command::new("nmap").args(&nmap_args).output() {
|
||||
Ok(_) => {
|
||||
if Path::new(&filename).exists() && Path::new(&filename).is_file() {
|
||||
serde_xml_rs::from_str(&std::fs::read_to_string(filename).unwrap_or_default())
|
||||
} else {
|
||||
error!("Error executing nmap, you need root permissions. Leaving.\n");
|
||||
error!("Error executing nmap, possible causes: Nmap is not installed or you need root/administrator permissions. Leaving.\n");
|
||||
std::process::exit(1)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue