Skip to content

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

API sanity checks and error reporting.

smicallef4a46fa99aa95
diff --git a/modules/sfp_shodan.py b/modules/sfp_shodan.py
index 5d6f82cd..2628d6d9 100644
--- a/modules/sfp_shodan.py
+++ b/modules/sfp_shodan.py
@@ -66,6 +66,10 @@ class sfp_shodan(SpiderFootPlugin):
sf.debug("Received event, " + eventName + ", from " + srcModuleName)
+ if self.opts['apikey'] == "":
+ sf.error("You enabled sfp_shodan but did not set an API key!", False)
+ return None
+
# Don't look up stuff twice
if self.results.has_key(eventData):
sf.debug("Skipping " + eventData + " as already mapped.")
diff --git a/modules/sfp_virustotal.py b/modules/sfp_virustotal.py
index b383c3aa..58d1c9fd 100644
--- a/modules/sfp_virustotal.py
+++ b/modules/sfp_virustotal.py
@@ -75,6 +75,10 @@ class sfp_virustotal(SpiderFootPlugin):
sf.debug("Received event, " + eventName + ", from " + srcModuleName)
+ if self.opts['apikey'] == "":
+ sf.error("You enabled sfp_virustotal but did not set an API key!", False)
+ return None
+
# Don't look up stuff twice
if self.results.has_key(eventData):
sf.debug("Skipping " + eventData + " as already mapped.")
@@ -146,6 +150,10 @@ class sfp_virustotal(SpiderFootPlugin):
res = sf.fetchUrl(url + self.baseDomain + "&apikey=" + self.opts['apikey'],
timeout=self.opts['_fetchtimeout'], useragent="SpiderFoot")
+ if res['code'] == 403:
+ sf.error("VirusTotal API limit reached or invalid API key.", False)
+ return None
+
if res['content'] == None:
sf.info("No VirusTotal info found for " + self.baseDomain)
return None