feat: add custom scan timeout env UPSNAP_SCAN_TIMEOUT #193

This commit is contained in:
seriousm4x
2023-12-22 09:14:14 +01:00
parent cb05d37bdb
commit 30c074930c

View File

@@ -4,6 +4,7 @@ import (
"encoding/xml"
"net"
"net/http"
"os"
"os/exec"
"strconv"
"strings"
@@ -146,7 +147,11 @@ func HandlerScan(c echo.Context) error {
}
// run nmap
cmd := exec.Command(nmap, "-sn", "-oX", "-", scanRange, "--host-timeout", "500ms")
timeout := os.Getenv("UPSNAP_SCAN_TIMEOUT")
if timeout == "" {
timeout = "500ms"
}
cmd := exec.Command(nmap, "-sn", "-oX", "-", scanRange, "--host-timeout", timeout)
cmdOutput, err := cmd.Output()
if err != nil {
return err