Fixed popup window
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
[target.x86_64-pc-windows-gnu]
|
||||||
|
linker = "x86_64-w64-mingw32-gcc"
|
||||||
|
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
|
||||||
@@ -48,7 +48,12 @@ pub async fn run_nmap(app: AppHandle, config: NmapConfig) -> Result<(), String>
|
|||||||
}
|
}
|
||||||
cmd.stdout(Stdio::piped());
|
cmd.stdout(Stdio::piped());
|
||||||
cmd.stderr(Stdio::piped());
|
cmd.stderr(Stdio::piped());
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
{
|
||||||
|
use std::os::windows::process::CommandExt;
|
||||||
|
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||||
|
cmd.creation_flags(CREATE_NO_WINDOW);
|
||||||
|
}
|
||||||
let mut child = cmd
|
let mut child = cmd
|
||||||
.spawn()
|
.spawn()
|
||||||
.map_err(|e| format!("Failed to start nmap: {}", e))?;
|
.map_err(|e| format!("Failed to start nmap: {}", e))?;
|
||||||
|
|||||||
@@ -15,18 +15,30 @@ pub async fn run_traceroute(app: AppHandle, ip: String) -> Result<(), String> {
|
|||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.stderr(Stdio::piped())
|
.stderr(Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
.map_err(|e| format!("Failed to start tracepath: {}. Is iputils-tracepath installed?", e))?;
|
.map_err(|e| {
|
||||||
|
format!(
|
||||||
|
"Failed to start tracepath: {}. Is iputils-tracepath installed?",
|
||||||
|
e
|
||||||
|
)
|
||||||
|
})?;
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let mut child = Command::new("tracert")
|
let mut child = {
|
||||||
.arg("-d")
|
use std::os::windows::process::CommandExt;
|
||||||
.arg(&ip)
|
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||||
.stdout(Stdio::piped())
|
Command::new("tracert")
|
||||||
.stderr(Stdio::piped())
|
.arg("-d")
|
||||||
.spawn()
|
.arg(&ip)
|
||||||
.map_err(|e| format!("Failed to start tracert: {}", e))?;
|
.stdout(Stdio::piped())
|
||||||
|
.stderr(Stdio::piped())
|
||||||
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
|
.spawn()
|
||||||
|
.map_err(|e| format!("Failed to start tracert: {}", e))?
|
||||||
|
};
|
||||||
|
|
||||||
let stdout = child.stdout.take()
|
let stdout = child
|
||||||
|
.stdout
|
||||||
|
.take()
|
||||||
.ok_or_else(|| "Failed to capture stdout".to_string())?;
|
.ok_or_else(|| "Failed to capture stdout".to_string())?;
|
||||||
|
|
||||||
let mut reader = BufReader::new(stdout).lines();
|
let mut reader = BufReader::new(stdout).lines();
|
||||||
@@ -35,7 +47,9 @@ pub async fn run_traceroute(app: AppHandle, ip: String) -> Result<(), String> {
|
|||||||
let _ = app.emit("traceroute:hop", &line);
|
let _ = app.emit("traceroute:hop", &line);
|
||||||
}
|
}
|
||||||
|
|
||||||
let status = child.wait().await
|
let status = child
|
||||||
|
.wait()
|
||||||
|
.await
|
||||||
.map_err(|e| format!("tracepath failed: {}", e))?;
|
.map_err(|e| format!("tracepath failed: {}", e))?;
|
||||||
|
|
||||||
if status.success() {
|
if status.success() {
|
||||||
@@ -45,4 +59,4 @@ pub async fn run_traceroute(app: AppHandle, ip: String) -> Result<(), String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ pub async fn ping_sweep(
|
|||||||
while let Some(result) = join_set.join_next().await {
|
while let Some(result) = join_set.join_next().await {
|
||||||
done += 1;
|
done += 1;
|
||||||
match result {
|
match result {
|
||||||
Ok(mut host_result) => {
|
Ok(host_result) => {
|
||||||
// Emit immediately so the host shows up in the table
|
// Emit immediately so the host shows up in the table
|
||||||
let _ = app.emit("scan:host-found", &host_result);
|
let _ = app.emit("scan:host-found", &host_result);
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,11 @@
|
|||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
|
"windows": {
|
||||||
|
"webviewInstallMode": {
|
||||||
|
"type": "embedBootstrapper"
|
||||||
|
}
|
||||||
|
},
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
@@ -30,4 +35,4 @@
|
|||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user