SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Python 3 fixes.
smicallefebc9075be97e
diff --git a/modules/sfp_censys.py b/modules/sfp_censys.pyindex 89c36e3b..78080e81 100644--- a/modules/sfp_censys.py+++ b/modules/sfp_censys.py@@ -68,10 +68,12 @@ class sfp_censys(SpiderFootPlugin):if querytype == "host":querytype = "websites/{0}"- token = self.opts['censys_api_key_uid'] + ":" + self.opts['censys_api_key_secret']+ secret = self.opts['censys_api_key_uid'] + ':' + self.opts['censys_api_key_secret']+ b64_val = base64.b64encode(secret.encode('utf-8'))headers = {- 'Authorization': "Basic " + base64.b64encode(token.encode("utf-8"))+ 'Authorization': 'Basic %s' % b64_val}+res = self.sf.fetchUrl('https://censys.io/api/v1/view/' + querytype.format(qry.encode('utf-8', errors='replace')),timeout=self.opts['_fetchtimeout'],useragent="SpiderFoot",diff --git a/modules/sfp_circllu.py b/modules/sfp_circllu.pyindex 5cd726be..7e6ee3f5 100644--- a/modules/sfp_circllu.py+++ b/modules/sfp_circllu.py@@ -77,10 +77,10 @@ class sfp_circllu(SpiderFootPlugin):else:url = "https://www.circl.lu/v2pssl/query/" + qry- token = f"{self.opts['api_key_login']}:{self.opts['api_key_password']}"- cred = base64.b64encode(token.encode("utf-8"))+ secret = self.opts['api_key_login'] + ':' + self.opts['api_key_password']+ b64_val = base64.b64encode(secret.encode('utf-8'))headers = {- 'Authorization': "Basic " + cred+ 'Authorization': 'Basic %s' % b64_val}# Be more forgiving with the timeout as some queries for subnets can be slowdiff --git a/modules/sfp_clearbit.py b/modules/sfp_clearbit.pyindex f2146654..8dad297f 100644--- a/modules/sfp_clearbit.py+++ b/modules/sfp_clearbit.py@@ -16,9 +16,6 @@ from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_clearbit(SpiderFootPlugin):"""Clearbit:Footprint,Investigate,Passive:Search Engines:apikey:Check for names, addresses, domains and more based on lookups of e-mail addresses on clearbit.com."""---# Default optionsopts = {"api_key": ""@@ -58,12 +55,16 @@ class sfp_clearbit(SpiderFootPlugin):def query(self, t):ret = None+ api_key = self.opts['api_key']+ if type(api_key) == str:+ api_key = api_key.encode('utf-8')url = "https://person.clearbit.com/v2/combined/find?email=" + t- token = self.opts['api_key'] + ":"+ token = base64.b64encode(api_key + ':'.encode('utf-8'))headers = {'Accept': 'application/json',- 'Authorization': "Basic " + base64.b64encode(token.encode("utf-8"))+ 'Authorization': "Basic " + token.decode('utf-8')}+res = self.sf.fetchUrl(url, timeout=self.opts['_fetchtimeout'],useragent="SpiderFoot", headers=headers)diff --git a/modules/sfp_fraudguard.py b/modules/sfp_fraudguard.pyindex 87af5ea4..acceead3 100644--- a/modules/sfp_fraudguard.py+++ b/modules/sfp_fraudguard.py@@ -65,10 +65,15 @@ class sfp_fraudguard(SpiderFootPlugin):def query(self, qry):fraudguard_url = "https://api.fraudguard.io/ip/" + qry-- token = self.opts['fraudguard_api_key_account'] + ":" + self.opts['fraudguard_api_key_password']+ api_key_account = self.opts['fraudguard_api_key_account']+ if type(api_key_account) == str:+ api_key_account = api_key_account.encode('utf-8')+ api_key_password = self.opts['fraudguard_api_key_password']+ if type(api_key_password) == str:+ api_key_password = api_key_password.encode('utf-8')+ token = base64.b64encode(api_key_account + ':'.encode('utf-8') + api_key_password)headers = {- 'Authorization': "Basic " + base64.b64encode(token.encode("utf-8"))+ 'Authorization': "Basic " + token.decode('utf-8')}res = self.sf.fetchUrl(fraudguard_url , timeout=self.opts['_fetchtimeout'],diff --git a/modules/sfp_riskiq.py b/modules/sfp_riskiq.pyindex 0576fb18..5ff2654a 100644--- a/modules/sfp_riskiq.py+++ b/modules/sfp_riskiq.py@@ -81,10 +81,15 @@ class sfp_riskiq(SpiderFootPlugin):url = "https://api.passivetotal.org/v2/whois/search"post = '{"field": "email", "query": "' + qry + '"}'- token = f"{self.opts['api_key_login']}:{self.opts['api_key_password']}"- cred = base64.b64encode(token.encode("utf-8"))+ api_key_login = self.opts['api_key_login']+ if type(api_key_login) == str:+ api_key_login = api_key_login.encode('utf-8')+ api_key_password = self.opts['api_key_password']+ if type(api_key_password) == str:+ api_key_password = api_key_password.encode('utf-8')+ cred = base64.b64encode(api_key_login + ":".encode('utf-8') + api_key_password)headers = {- 'Authorization': "Basic " + cred,+ 'Authorization': "Basic " + cred.decode('utf-8'),'Content-Type': 'application/json'}diff --git a/modules/sfp_xforce.py b/modules/sfp_xforce.pyindex 9b802d30..b5ba5d35 100644--- a/modules/sfp_xforce.py+++ b/modules/sfp_xforce.py@@ -85,10 +85,17 @@ class sfp_xforce(SpiderFootPlugin):querytype = "ipr/malware"xforce_url = "https://api.xforce.ibmcloud.com"- xforce_token = f"{self.opts['xforce_api_key']}:{self.opts['xforce_api_key_password']}"++ api_key = self.opts['xforce_api_key']+ if type(api_key) == str:+ api_key = api_key.encode('utf-8')+ api_key_password = self.opts['xforce_api_key_password']+ if type(api_key_password) == str:+ api_key_password = api_key_password.encode('utf-8')+ token = base64.b64encode(api_key + ":".encode('utf-8') + api_key_password)headers = {'Accept': 'application/json',- 'Authorization': "Basic " + base64.b64encode(xforce_token.encode("utf-8"))+ 'Authorization': "Basic " + token.decode('utf-8')}url = xforce_url + "/" + querytype + "/" + qryres = self.sf.fetchUrl(url , timeout=self.opts['_fetchtimeout'], useragent="SpiderFoot", headers=headers)diff --git a/sflib.py b/sflib.pyindex 15209252..39c96325 100644--- a/sflib.py+++ b/sflib.py@@ -1732,6 +1732,9 @@ class SpiderFootPlugin(object):#print("EVENT: " + str(sfEvent))try:+ if type(sfEvent.data) == bytes:+ sfEvent.data = sfEvent.data.decode('utf-8', 'ignore')+listener.handleEvent(sfEvent)except BaseException as e:f = open("sferror.log", "a")@@ -2012,7 +2015,7 @@ class PublicSuffixList(object):#if input_file is None:#input_path = os.path.join(os.path.dirname(__file__), 'publicsuffix.txt')- #input_file = codecs.open(input_path, "r", "utf8")+ #input_file = codecs.open(input_path, "r", "utf-8")root = self._build_structure(input_data)self.root = self._simplify(root)