Skip to content

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

make multiple finish() passes to ensure new events are processed (#1573)

TheTechromancer46d6b6a96da0
diff --git a/sfscan.py b/sfscan.py
index f2d2438b..c2bc2358 100644
--- a/sfscan.py
+++ b/sfscan.py
@@ -433,7 +433,7 @@ class SpiderFootScanner():
# start one thread for each module
for mod in self.__moduleInstances.values():
mod.start()
- modulesFinished = False
+ final_passes = 3
# watch for newly-generated events
while True:
@@ -451,7 +451,7 @@ class SpiderFootScanner():
sleep(.1)
# but are we really?
if self.threadsFinished(log_status):
- if modulesFinished:
+ if final_passes < 1:
break
# Trigger module.finished()
for mod in self.__moduleInstances.values():
@@ -462,7 +462,7 @@ class SpiderFootScanner():
log_status = counter % 100 == 0
counter += 1
sleep(.01)
- modulesFinished = True
+ final_passes -= 1
else:
# save on CPU
diff --git a/spiderfoot/plugin.py b/spiderfoot/plugin.py
index a53c5124..01cb4602 100644
--- a/spiderfoot/plugin.py
+++ b/spiderfoot/plugin.py
@@ -492,6 +492,7 @@ class SpiderFootPlugin():
def finish(self):
"""Perform final/cleanup functions before module exits
+ Note that this function may be called multiple times
Overridden by the implementer
"""