Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

SpiderFootPlugin: Allow scans with STARTING status to be stopped (#1385)

bcoles11e314473b60
diff --git a/sfwebui.py b/sfwebui.py
index 5d53f851..bb1590ee 100644
--- a/sfwebui.py
+++ b/sfwebui.py
@@ -1431,7 +1431,7 @@ class SpiderFootWebUi:
if scan_status == "ABORTED":
return self.jsonify_error('400', f"Scan {scan_id} has already aborted.")
- if scan_status != "RUNNING":
+ if scan_status != "RUNNING" and scan_status != "STARTING":
return self.jsonify_error('400', f"The running scan is currently in the state '{scan_status}', please try again later or restart SpiderFoot.")
for scan_id in ids:
diff --git a/spiderfoot/plugin.py b/spiderfoot/plugin.py
index 391f496e..dcb8d81f 100644
--- a/spiderfoot/plugin.py
+++ b/spiderfoot/plugin.py
@@ -299,20 +299,21 @@ class SpiderFootPlugin():
"""
if self.outgoingEventQueue and self.incomingEventQueue:
return self._stopScanning
- else:
- if not self.__scanId__:
- return False
-
- scanstatus = self.__sfdb__.scanInstanceGet(self.__scanId__)
- if not scanstatus:
- return False
+ if not self.__scanId__:
+ return False
- if scanstatus[5] == "ABORT-REQUESTED":
- return True
+ scanstatus = self.__sfdb__.scanInstanceGet(self.__scanId__)
+ if not scanstatus:
return False
+ if scanstatus[5] == "ABORT-REQUESTED":
+ self._stopScanning = True
+ return True
+
+ return False
+
def watchedEvents(self):
"""What events is this module interested in for input. The format is a list
of event types that are applied to event types that this module wants to