diff --git a/VERSION b/VERSION index e7a15ceb..a7ccabdb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.19 +1.5.20 diff --git a/engines/nmap/Dockerfile b/engines/nmap/Dockerfile index 96dcd19e..01a3ca80 100644 --- a/engines/nmap/Dockerfile +++ b/engines/nmap/Dockerfile @@ -1,5 +1,5 @@ FROM alpine:3.16.3 -LABEL Name="Nmap\ \(Patrowl engine\)" Version="1.4.46" +LABEL Name="Nmap\ \(Patrowl engine\)" Version="1.4.47" # Set the working directory RUN mkdir -p /opt/patrowl-engines/nmap diff --git a/engines/nmap/VERSION b/engines/nmap/VERSION index 7c3125c0..377504d5 100644 --- a/engines/nmap/VERSION +++ b/engines/nmap/VERSION @@ -1 +1 @@ -1.4.46 +1.4.47 diff --git a/engines/nmap/engine-nmap.py b/engines/nmap/engine-nmap.py index a4841d0a..091f5d8b 100644 --- a/engines/nmap/engine-nmap.py +++ b/engines/nmap/engine-nmap.py @@ -365,9 +365,8 @@ def _scan_thread(scan_id): this.scans[scan_id]["issues"] = deepcopy(issues) except Exception as e: - print(e) app.logger.info(e) - traceback.print_exception(*sys.exc_info()) + # traceback.print_exception(*sys.exc_info()) this.scans[scan_id]["status"] = "ERROR" this.scans[scan_id]["issues_available"] = False this.scans[scan_id]["issues_available"] = True @@ -423,11 +422,9 @@ def stop_scan(scan_id): res.update({"status": "error", "reason": f"scan_id '{scan_id}' not found"}) return jsonify(res) + # Stop the nmap cmd proc = this.scans[scan_id]["proc"] if hasattr(proc, "pid"): - # his.proc.terminate() - # proc.kill() - # os.killpg(os.getpgid(proc.pid), signal.SIGTERM) if psutil.pid_exists(proc.pid): psutil.Process(proc.pid).terminate() res.update( @@ -441,6 +438,10 @@ def stop_scan(scan_id): } ) + # Stop the thread '_scan_thread' + for th in this.scans[scan_id]["threads"]: + th.join() + this.scans[scan_id]["status"] = "STOPPED" # this.scans[scan_id]["finished_at"] = int(time.time() * 1000) return jsonify(res)