Skip to content

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

Use self.checkForStop() in module loops

Brendan Colesc8716e71e974
diff --git a/modules/sfp_darksearch.py b/modules/sfp_darksearch.py
index 25a48e04..a33bed57 100644
--- a/modules/sfp_darksearch.py
+++ b/modules/sfp_darksearch.py
@@ -89,6 +89,9 @@ class sfp_darksearch(SpiderFootPlugin):
page = 1
pages = self.opts['max_pages']
while page <= pages:
+ if self.checkForStop():
+ return None
+
res = self.query(eventData, page)
if res is None:
diff --git a/modules/sfp_dnsneighbor.py b/modules/sfp_dnsneighbor.py
index 1ddbe2c5..73aa23e0 100644
--- a/modules/sfp_dnsneighbor.py
+++ b/modules/sfp_dnsneighbor.py
@@ -87,11 +87,12 @@ class sfp_dnsneighbor(SpiderFootPlugin):
c = int(maxip)
while s <= c:
- sip = str(IPAddress(s))
- self.sf.debug("Attempting look-aside lookup of: " + sip)
if self.checkForStop():
return None
+ sip = str(IPAddress(s))
+ self.sf.debug("Attempting look-aside lookup of: " + sip)
+
if sip in self.hostresults or sip == eventData:
s += 1
continue
diff --git a/modules/sfp_flickr.py b/modules/sfp_flickr.py
index 9a24eb76..3e55ad54 100644
--- a/modules/sfp_flickr.py
+++ b/modules/sfp_flickr.py
@@ -105,6 +105,9 @@ class sfp_flickr(SpiderFootPlugin):
pages = self.opts['maxpages']
per_page = self.opts['per_page']
while page <= pages:
+ if self.checkForStop():
+ return None
+
res = self.query("@"+eventData, api_key, page=page, per_page=per_page)
if res is None:
diff --git a/modules/sfp_intelx.py b/modules/sfp_intelx.py
index e9fb1882..ed48d453 100644
--- a/modules/sfp_intelx.py
+++ b/modules/sfp_intelx.py
@@ -115,6 +115,9 @@ class sfp_intelx(SpiderFootPlugin):
count = 0
status = 3 # status 3 = No results yet, keep trying. 0 = Success with results
while status == 3 and count < limit:
+ if self.checkForStop():
+ return None
+
res = self.sf.fetchUrl(resulturl, headers=headers)
if res['content'] is None:
self.sf.info("No IntelligenceX info found for results from " + qry)
diff --git a/modules/sfp_onionsearchengine.py b/modules/sfp_onionsearchengine.py
index e22d6d10..0665fca3 100644
--- a/modules/sfp_onionsearchengine.py
+++ b/modules/sfp_onionsearchengine.py
@@ -67,6 +67,9 @@ class sfp_onionsearchengine(SpiderFootPlugin):
paging = ""
pagenr = 1
while keepGoing:
+ if self.checkForStop():
+ return None
+
# Sites hosted on the domain
data = self.sf.fetchUrl("https://onionsearchengine.com/search.php?search=\"" + \
eventData.replace(" ", "%20") + "\"&submit=Search" + paging,
diff --git a/modules/sfp_scylla.py b/modules/sfp_scylla.py
index 989813d6..7a948387 100644
--- a/modules/sfp_scylla.py
+++ b/modules/sfp_scylla.py
@@ -110,6 +110,9 @@ class sfp_scylla(SpiderFootPlugin):
passwords = list()
while position < (per_page * max_pages):
+ if self.checkForStop():
+ return None
+
if self.errorState:
break
diff --git a/modules/sfp_torch.py b/modules/sfp_torch.py
index 71fe2281..86a1f59d 100644
--- a/modules/sfp_torch.py
+++ b/modules/sfp_torch.py
@@ -81,6 +81,10 @@ class sfp_torch(SpiderFootPlugin):
pagecount = 0
p = ""
while "color=gray>next &gt;&gt;" not in pagecontent.lower() and pagecount < self.opts['pages']:
+ # Check if we've been asked to stop
+ if self.checkForStop():
+ return None
+
if pagecount > 0:
p = "&np=" + str(pagecount)
pagecount += 1
@@ -97,10 +101,6 @@ class sfp_torch(SpiderFootPlugin):
pagecontent = data['content']
if "No documents were found" not in data['content']:
- # Check if we've been asked to stop
- if self.checkForStop():
- return None
-
# Submit the google results for analysis
evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", data['content'],
self.__name__, event)