SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Py2->Py3 changes.
smicallef5c4c7449fe65
diff --git a/modules/sfp__stor_db.py b/modules/sfp__stor_db.pyindex 49810cf7..9945d6dd 100644--- a/modules/sfp__stor_db.py+++ b/modules/sfp__stor_db.py@@ -31,7 +31,7 @@ class sfp__stor_db(SpiderFootPlugin):def setup(self, sfc, userOpts=dict()):self.sf = sfc- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp__stor_stdout.py b/modules/sfp__stor_stdout.pyindex 5f193b9a..3b25d745 100644--- a/modules/sfp__stor_stdout.py+++ b/modules/sfp__stor_stdout.py@@ -36,7 +36,7 @@ class sfp__stor_stdout(SpiderFootPlugin):def setup(self, sfc, userOpts=dict()):self.sf = sfc- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -48,20 +48,20 @@ class sfp__stor_stdout(SpiderFootPlugin):def output(self, event):d = self.opts['_csvdelim']if type(event.data) in [list, dict]:- data = unicode(str(event.data), 'utf-8', errors='replace')+ data = str(event.data)else:data = event.data- if type(data) != unicode:- data = unicode(event.data, 'utf-8', errors='replace')+ if type(data) != str:+ data = str(event.data)if type(event.sourceEvent.data) in [list, dict]:- srcdata = unicode(str(event.sourceEvent.data), 'utf-8', errors='replace')+ srcdata = str(event.sourceEvent.data)else:srcdata = event.sourceEvent.data- if type(srcdata) != unicode:- srcdata = unicode(event.sourceEvent.data, 'utf-8', errors='replace')+ if type(srcdata) != str:+ srcdata = str(event.sourceEvent.data)if self.opts['_stripnewline']:data = data.replace("\n", "").replace("\r", "")@@ -73,12 +73,12 @@ class sfp__stor_stdout(SpiderFootPlugin):if self.opts['_format'] == "tab":if self.opts['_showsource']:- print('{0:30}\t{1:45}\t{2}\t{3}'.format(event.module, self.opts['_eventtypes'][event.eventType], srcdata, data))+ print(('{0:30}\t{1:45}\t{2}\t{3}'.format(event.module, self.opts['_eventtypes'][event.eventType], srcdata, data)))else:- print('{0:30}\t{1:45}\t{2}'.format(event.module, self.opts['_eventtypes'][event.eventType], data))+ print(('{0:30}\t{1:45}\t{2}'.format(event.module, self.opts['_eventtypes'][event.eventType], data)))if self.opts['_format'] == "csv":- print(event.module + d + self.opts['_eventtypes'][event.eventType] + d + srcdata + d + data)+ print((event.module + d + self.opts['_eventtypes'][event.eventType] + d + srcdata + d + data))if self.opts['_format'] == "json":d = event.asDict()diff --git a/modules/sfp_abusech.py b/modules/sfp_abusech.pyindex c5473060..8490f04d 100644--- a/modules/sfp_abusech.py+++ b/modules/sfp_abusech.py@@ -108,7 +108,7 @@ class sfp_abusech(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -149,10 +149,10 @@ class sfp_abusech(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -171,7 +171,7 @@ class sfp_abusech(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -229,8 +229,8 @@ class sfp_abusech(SpiderFootPlugin):else:try:# Check for the domain and the hostname- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -243,7 +243,7 @@ class sfp_abusech(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -279,7 +279,7 @@ class sfp_abusech(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_abuseipdb.py b/modules/sfp_abuseipdb.pyindex 02bea284..b3c89f9f 100644--- a/modules/sfp_abuseipdb.py+++ b/modules/sfp_abuseipdb.py@@ -66,7 +66,7 @@ class sfp_abuseipdb(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -106,10 +106,10 @@ class sfp_abuseipdb(SpiderFootPlugin):apikey = self.opts['api_key']daysback = self.opts['daysback']self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target, apikey, daysback),timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'])@@ -132,7 +132,7 @@ class sfp_abuseipdb(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -163,7 +163,7 @@ class sfp_abuseipdb(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if eventName in ['IP_ADDRESS', 'AFFILIATE_IPADDR']:typeId = 'ip'diff --git a/modules/sfp_accounts.py b/modules/sfp_accounts.pyindex 6d3e6349..5dbd4f0d 100644--- a/modules/sfp_accounts.py+++ b/modules/sfp_accounts.py@@ -59,7 +59,7 @@ class sfp_accounts(SpiderFootPlugin):self.__dataSource__ = "Social Media"self.lock = threading.Lock()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]self.commonNames = set(self.sf.dictnames())@@ -191,7 +191,7 @@ class sfp_accounts(SpiderFootPlugin):if data == None:return res- for ret in data.keys():+ for ret in list(data.keys()):if data[ret]:res.append(ret)i = 0@@ -218,7 +218,7 @@ class sfp_accounts(SpiderFootPlugin):if eventName != "USERNAME" and srcModuleName == "sfp_accounts":return None- if eventData not in self.results.keys():+ if eventData not in list(self.results.keys()):self.results[eventData] = Trueelse:return Nonediff --git a/modules/sfp_adblock.py b/modules/sfp_adblock.pyindex ddcb8bfd..d395b22f 100644--- a/modules/sfp_adblock.py+++ b/modules/sfp_adblock.py@@ -37,7 +37,7 @@ class sfp_adblock(SpiderFootPlugin):self.rules = Noneself.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_ahmia.py b/modules/sfp_ahmia.pyindex 281234a6..085bd223 100644--- a/modules/sfp_ahmia.py+++ b/modules/sfp_ahmia.py@@ -39,7 +39,7 @@ class sfp_ahmia(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_alienvault.py b/modules/sfp_alienvault.pyindex 879614c0..e255b873 100644--- a/modules/sfp_alienvault.py+++ b/modules/sfp_alienvault.py@@ -56,7 +56,7 @@ class sfp_alienvault(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_alienvaultiprep.py b/modules/sfp_alienvaultiprep.pyindex 2011cfa4..8808a76a 100644--- a/modules/sfp_alienvaultiprep.py+++ b/modules/sfp_alienvaultiprep.py@@ -64,7 +64,7 @@ class sfp_alienvaultiprep(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -102,10 +102,10 @@ class sfp_alienvaultiprep(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -124,7 +124,7 @@ class sfp_alienvaultiprep(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -182,8 +182,8 @@ class sfp_alienvaultiprep(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -196,7 +196,7 @@ class sfp_alienvaultiprep(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -232,7 +232,7 @@ class sfp_alienvaultiprep(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_apility.py b/modules/sfp_apility.pyindex e94a69a8..0fdedfe0 100644--- a/modules/sfp_apility.py+++ b/modules/sfp_apility.py@@ -41,7 +41,7 @@ class sfp_apility(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_archiveorg.py b/modules/sfp_archiveorg.pyindex b4b57cc4..6b5fbb03 100644--- a/modules/sfp_archiveorg.py+++ b/modules/sfp_archiveorg.py@@ -55,7 +55,7 @@ class sfp_archiveorg(SpiderFootPlugin):self.results = self.tempStorage()self.foundDates = list()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_arin.py b/modules/sfp_arin.pyindex 930b0edb..75394b48 100644--- a/modules/sfp_arin.py+++ b/modules/sfp_arin.py@@ -33,7 +33,7 @@ class sfp_arin(SpiderFootPlugin):self.memCache = dict()self.currentEventSrc = None- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_azureblobstorage.py b/modules/sfp_azureblobstorage.pyindex 36d95f14..9a706831 100644--- a/modules/sfp_azureblobstorage.py+++ b/modules/sfp_azureblobstorage.py@@ -39,7 +39,7 @@ class sfp_azureblobstorage(SpiderFootPlugin):self.results = self.tempStorage()self.lock = threading.Lock()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -102,7 +102,7 @@ class sfp_azureblobstorage(SpiderFootPlugin):if data == None:return res- for ret in data.keys():+ for ret in list(data.keys()):if data[ret]:res.append(ret)i = 0diff --git a/modules/sfp_badipscom.py b/modules/sfp_badipscom.pyindex 10f68538..48a3aff1 100644--- a/modules/sfp_badipscom.py+++ b/modules/sfp_badipscom.py@@ -60,7 +60,7 @@ class sfp_badipscom(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -101,10 +101,10 @@ class sfp_badipscom(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -123,7 +123,7 @@ class sfp_badipscom(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -181,8 +181,8 @@ class sfp_badipscom(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -195,7 +195,7 @@ class sfp_badipscom(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -227,7 +227,7 @@ class sfp_badipscom(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_bambenek.py b/modules/sfp_bambenek.pyindex 5b77e369..12963749 100644--- a/modules/sfp_bambenek.py+++ b/modules/sfp_bambenek.py@@ -73,7 +73,7 @@ class sfp_bambenek(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -114,10 +114,10 @@ class sfp_bambenek(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -136,7 +136,7 @@ class sfp_bambenek(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -194,8 +194,8 @@ class sfp_bambenek(SpiderFootPlugin):else:try:# Check for the domain and the hostname- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -208,7 +208,7 @@ class sfp_bambenek(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -244,7 +244,7 @@ class sfp_bambenek(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_base64.py b/modules/sfp_base64.pyindex 62b753b2..9a6260b2 100644--- a/modules/sfp_base64.py+++ b/modules/sfp_base64.py@@ -35,7 +35,7 @@ class sfp_base64(SpiderFootPlugin):self.sf = sfcself.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -69,10 +69,8 @@ class sfp_base64(SpiderFootPlugin):if caps < (minlen/4):return Noneself.sf.info("Found Base64 string: " + match)- if type(match) == str:- string = unicode(match, 'utf-8', errors='replace')- else:- string = match+ if type(match) != str:+ string = str(match, 'utf-8', errors='replace')try:string += " (" + base64.b64decode(match) + ")"diff --git a/modules/sfp_bgpview.py b/modules/sfp_bgpview.pyindex 03ff4e2d..bb22316b 100644--- a/modules/sfp_bgpview.py+++ b/modules/sfp_bgpview.py@@ -30,7 +30,7 @@ class sfp_bgpview(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def watchedEvents(self):@@ -183,7 +183,7 @@ class sfp_bgpview(SpiderFootPlugin):if not address:return None- evt = SpiderFootEvent('PHYSICAL_ADDRESS', ', '.join(filter(None, address)), self.__name__, event)+ evt = SpiderFootEvent('PHYSICAL_ADDRESS', ', '.join([_f for _f in address if _f]), self.__name__, event)self.notifyListeners(evt)data = self.queryAsnPeers(eventData)@@ -229,7 +229,7 @@ class sfp_bgpview(SpiderFootPlugin):if not address:return None- evt = SpiderFootEvent('PHYSICAL_ADDRESS', ', '.join(filter(None, address)), self.__name__, event)+ evt = SpiderFootEvent('PHYSICAL_ADDRESS', ', '.join([_f for _f in address if _f]), self.__name__, event)self.notifyListeners(evt)if eventName in ['IP_ADDRESS', 'IPV6_ADDRESS']:diff --git a/modules/sfp_binaryedge.py b/modules/sfp_binaryedge.pyindex 5bcff5f5..9ef64324 100644--- a/modules/sfp_binaryedge.py+++ b/modules/sfp_binaryedge.py@@ -69,7 +69,7 @@ class sfp_binaryedge(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_bingsearch.py b/modules/sfp_bingsearch.pyindex ebcd7996..9d994c6e 100644--- a/modules/sfp_bingsearch.py+++ b/modules/sfp_bingsearch.py@@ -35,7 +35,7 @@ class sfp_bingsearch(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_bingsharedip.py b/modules/sfp_bingsharedip.pyindex 81f5058f..7eda3566 100644--- a/modules/sfp_bingsharedip.py+++ b/modules/sfp_bingsharedip.py@@ -46,7 +46,7 @@ class sfp_bingsharedip(SpiderFootPlugin):self.__dataSource__ = "Bing"self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_binstring.py b/modules/sfp_binstring.pyindex fdd18c4f..d2c9a570 100644--- a/modules/sfp_binstring.py+++ b/modules/sfp_binstring.py@@ -51,7 +51,7 @@ class sfp_binstring(SpiderFootPlugin):self.d = set(self.sf.dictwords())- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def getStrings(self, content):diff --git a/modules/sfp_bitcoin.py b/modules/sfp_bitcoin.pyindex ac1fa2fe..bf1efabf 100644--- a/modules/sfp_bitcoin.py+++ b/modules/sfp_bitcoin.py@@ -31,7 +31,7 @@ class sfp_bitcoin(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_blockchain.py b/modules/sfp_blockchain.pyindex fbd403b4..56ed9256 100644--- a/modules/sfp_blockchain.py+++ b/modules/sfp_blockchain.py@@ -27,7 +27,7 @@ class sfp_blockchain(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_blocklistde.py b/modules/sfp_blocklistde.pyindex b2b044b5..c63268b3 100644--- a/modules/sfp_blocklistde.py+++ b/modules/sfp_blocklistde.py@@ -63,7 +63,7 @@ class sfp_blocklistde(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -102,10 +102,10 @@ class sfp_blocklistde(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -124,7 +124,7 @@ class sfp_blocklistde(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -182,8 +182,8 @@ class sfp_blocklistde(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -196,7 +196,7 @@ class sfp_blocklistde(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -232,7 +232,7 @@ class sfp_blocklistde(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_botscout.py b/modules/sfp_botscout.pyindex 4af53bd0..5e280bc5 100644--- a/modules/sfp_botscout.py+++ b/modules/sfp_botscout.py@@ -31,7 +31,7 @@ class sfp_botscout(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_builtwith.py b/modules/sfp_builtwith.pyindex 17d526b1..5cd88a7c 100644--- a/modules/sfp_builtwith.py+++ b/modules/sfp_builtwith.py@@ -48,7 +48,7 @@ class sfp_builtwith(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -99,7 +99,7 @@ class sfp_builtwith(SpiderFootPlugin):return None# Don't look up stuff twice- if self.results.has_key(eventData):+ if eventData in self.results:self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneelse:diff --git a/modules/sfp_callername.py b/modules/sfp_callername.pyindex d57d0588..d709ce19 100644--- a/modules/sfp_callername.py+++ b/modules/sfp_callername.py@@ -38,7 +38,7 @@ class sfp_callername(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_censys.py b/modules/sfp_censys.pyindex 04fba76f..9491257f 100644--- a/modules/sfp_censys.py+++ b/modules/sfp_censys.py@@ -47,7 +47,7 @@ class sfp_censys(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -165,7 +165,7 @@ class sfp_censys(SpiderFootPlugin):continueif 'location' in rec:- location = ', '.join(filter(None, [rec['location'].get('city'), rec['location'].get('province'), rec['location'].get('postal_code'), rec['location'].get('country')]))+ location = ', '.join([_f for _f in [rec['location'].get('city'), rec['location'].get('province'), rec['location'].get('postal_code'), rec['location'].get('country')] if _f])if location:e = SpiderFootEvent("GEOINFO", location, self.__name__, event)self.notifyListeners(e)diff --git a/modules/sfp_cinsscore.py b/modules/sfp_cinsscore.pyindex dbece7ba..c87840bb 100644--- a/modules/sfp_cinsscore.py+++ b/modules/sfp_cinsscore.py@@ -61,7 +61,7 @@ class sfp_cinsscore(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -100,10 +100,10 @@ class sfp_cinsscore(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -122,7 +122,7 @@ class sfp_cinsscore(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -180,8 +180,8 @@ class sfp_cinsscore(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -194,7 +194,7 @@ class sfp_cinsscore(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -230,7 +230,7 @@ class sfp_cinsscore(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_circllu.py b/modules/sfp_circllu.pyindex eb891d99..4b646a63 100644--- a/modules/sfp_circllu.py+++ b/modules/sfp_circllu.py@@ -58,7 +58,7 @@ class sfp_circllu(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_citadel.py b/modules/sfp_citadel.pyindex 585ba8c6..386d68f8 100644--- a/modules/sfp_citadel.py+++ b/modules/sfp_citadel.py@@ -11,7 +11,7 @@# -------------------------------------------------------------------------------import json-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_citadel(SpiderFootPlugin):@@ -34,7 +34,7 @@ class sfp_citadel(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "Leak-Lookup.com"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -63,7 +63,7 @@ class sfp_citadel(SpiderFootPlugin):}res = self.sf.fetchUrl("https://leak-lookup.com/api/search",- postData=urllib.urlencode(params),+ postData=urllib.parse.urlencode(params),timeout=self.opts['timeout'],useragent=self.opts['_useragent'])diff --git a/modules/sfp_cleanbrowsing.py b/modules/sfp_cleanbrowsing.pyindex 92a4ba5a..3f5d2eb6 100644--- a/modules/sfp_cleanbrowsing.py+++ b/modules/sfp_cleanbrowsing.py@@ -32,7 +32,7 @@ class sfp_cleanbrowsing(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_cleantalk.py b/modules/sfp_cleantalk.pyindex 4fc4ca62..4d4e6d98 100644--- a/modules/sfp_cleantalk.py+++ b/modules/sfp_cleantalk.py@@ -61,7 +61,7 @@ class sfp_cleantalk(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -100,10 +100,10 @@ class sfp_cleantalk(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -122,7 +122,7 @@ class sfp_cleantalk(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -180,8 +180,8 @@ class sfp_cleantalk(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -194,7 +194,7 @@ class sfp_cleantalk(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -230,7 +230,7 @@ class sfp_cleantalk(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_clearbit.py b/modules/sfp_clearbit.pyindex d4200a31..206ad449 100644--- a/modules/sfp_clearbit.py+++ b/modules/sfp_clearbit.py@@ -43,7 +43,7 @@ class sfp_clearbit(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -97,7 +97,7 @@ class sfp_clearbit(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)# Don't look up stuff twice- if self.results.has_key(eventData):+ if eventData in self.results:self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneelse:diff --git a/modules/sfp_coinblocker.py b/modules/sfp_coinblocker.pyindex f6062516..faf49ee6 100644--- a/modules/sfp_coinblocker.py+++ b/modules/sfp_coinblocker.py@@ -73,7 +73,7 @@ class sfp_coinblocker(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -114,10 +114,10 @@ class sfp_coinblocker(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -136,7 +136,7 @@ class sfp_coinblocker(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -194,8 +194,8 @@ class sfp_coinblocker(SpiderFootPlugin):else:try:# Check for the domain and the hostname- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -208,7 +208,7 @@ class sfp_coinblocker(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -244,7 +244,7 @@ class sfp_coinblocker(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_commoncrawl.py b/modules/sfp_commoncrawl.pyindex 5ca875ab..8953dae5 100644--- a/modules/sfp_commoncrawl.py+++ b/modules/sfp_commoncrawl.py@@ -44,7 +44,7 @@ class sfp_commoncrawl(SpiderFootPlugin):self.indexBase = list()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def search(self, target):@@ -91,7 +91,7 @@ class sfp_commoncrawl(SpiderFootPlugin):ms = m.replace("CC-MAIN-", "").replace("-", "")indexlist[ms] = True- topindexes = sorted(indexlist.keys(), reverse=True)[0:self.opts['indexes']]+ topindexes = sorted(list(indexlist.keys()), reverse=True)[0:self.opts['indexes']]if len(topindexes) < self.opts['indexes']:self.sf.error("Not able to find latest CommonCrawl indexes.", False)diff --git a/modules/sfp_comodo.py b/modules/sfp_comodo.pyindex d25f4a57..5ae0ceb6 100644--- a/modules/sfp_comodo.py+++ b/modules/sfp_comodo.py@@ -32,7 +32,7 @@ class sfp_comodo(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_company.py b/modules/sfp_company.pyindex a7f3e396..5914ac0f 100644--- a/modules/sfp_company.py+++ b/modules/sfp_company.py@@ -35,7 +35,7 @@ class sfp_company(SpiderFootPlugin):def setup(self, sfc, userOpts=dict()):self.sf = sfc- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -91,7 +91,7 @@ class sfp_company(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName + ": " + str(len(eventData)) + " bytes.")- if type(eventData) not in [str, unicode]:+ if type(eventData) != str:try:if type(eventData) in [ list, dict ]:eventData = str(eventData)diff --git a/modules/sfp_cookie.py b/modules/sfp_cookie.pyindex 401f4435..d1c778f4 100644--- a/modules/sfp_cookie.py+++ b/modules/sfp_cookie.py@@ -25,7 +25,7 @@ class sfp_cookie(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_crossref.py b/modules/sfp_crossref.pyindex d27b8123..fc97e525 100644--- a/modules/sfp_crossref.py+++ b/modules/sfp_crossref.py@@ -40,7 +40,7 @@ class sfp_crossref(SpiderFootPlugin):self.sf = sfcself.fetched = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_crt.py b/modules/sfp_crt.pyindex 646029a3..6df3ca0e 100644--- a/modules/sfp_crt.py+++ b/modules/sfp_crt.py@@ -12,7 +12,7 @@# -------------------------------------------------------------------------------import json-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent@@ -33,7 +33,7 @@ class sfp_crt(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -66,7 +66,7 @@ class sfp_crt(SpiderFootPlugin):'output': 'json'}- res = self.sf.fetchUrl('https://crt.sh/?' + urllib.urlencode(params),+ res = self.sf.fetchUrl('https://crt.sh/?' + urllib.parse.urlencode(params),timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'])@@ -135,7 +135,7 @@ class sfp_crt(SpiderFootPlugin):'d': str(cert_id)}- res = self.sf.fetchUrl('https://crt.sh/?' + urllib.urlencode(params),+ res = self.sf.fetchUrl('https://crt.sh/?' + urllib.parse.urlencode(params),timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'])diff --git a/modules/sfp_customfeed.py b/modules/sfp_customfeed.pyindex d02b9c05..0f69b30c 100644--- a/modules/sfp_customfeed.py+++ b/modules/sfp_customfeed.py@@ -61,7 +61,7 @@ class sfp_customfeed(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -105,7 +105,7 @@ class sfp_customfeed(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']url = self.opts['url']if id == cid:@@ -163,8 +163,8 @@ class sfp_customfeed(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -177,7 +177,7 @@ class sfp_customfeed(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -218,7 +218,7 @@ class sfp_customfeed(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_cybercrimetracker.py b/modules/sfp_cybercrimetracker.pyindex dcc16579..0e73fd5e 100644--- a/modules/sfp_cybercrimetracker.py+++ b/modules/sfp_cybercrimetracker.py@@ -60,7 +60,7 @@ class sfp_cybercrimetracker(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -101,10 +101,10 @@ class sfp_cybercrimetracker(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -123,7 +123,7 @@ class sfp_cybercrimetracker(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -181,8 +181,8 @@ class sfp_cybercrimetracker(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -194,7 +194,7 @@ class sfp_cybercrimetracker(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -226,7 +226,7 @@ class sfp_cybercrimetracker(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_darksearch.py b/modules/sfp_darksearch.pyindex 3c5324a8..b0460188 100644--- a/modules/sfp_darksearch.py+++ b/modules/sfp_darksearch.py@@ -13,7 +13,7 @@import jsonimport time-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_darksearch(SpiderFootPlugin):@@ -40,7 +40,7 @@ class sfp_darksearch(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def watchedEvents(self):@@ -56,7 +56,7 @@ class sfp_darksearch(SpiderFootPlugin):'page': str(page)}- res = self.sf.fetchUrl("https://darksearch.io/api/search?" + urllib.urlencode(params),+ res = self.sf.fetchUrl("https://darksearch.io/api/search?" + urllib.parse.urlencode(params),useragent=self.opts['_useragent'],timeout=self.opts['_fetchtimeout'])diff --git a/modules/sfp_digitaloceanspace.py b/modules/sfp_digitaloceanspace.pyindex 7c924718..8fa4ed4c 100644--- a/modules/sfp_digitaloceanspace.py+++ b/modules/sfp_digitaloceanspace.py@@ -42,7 +42,7 @@ class sfp_digitaloceanspace(SpiderFootPlugin):self.results = self.tempStorage()self.lock = threading.Lock()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -112,7 +112,7 @@ class sfp_digitaloceanspace(SpiderFootPlugin):if data == None:return res- for ret in data.keys():+ for ret in list(data.keys()):if data[ret]:# bucket:filecountres.append(ret + ":" + str(data[ret]))diff --git a/modules/sfp_dnsbrute.py b/modules/sfp_dnsbrute.pyindex 6870cdc7..09e3275a 100644--- a/modules/sfp_dnsbrute.py+++ b/modules/sfp_dnsbrute.py@@ -52,7 +52,7 @@ class sfp_dnsbrute(SpiderFootPlugin):self.__dataSource__ = "DNS"self.lock = threading.Lock()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]cslines = list()@@ -150,8 +150,8 @@ class sfp_dnsbrute(SpiderFootPlugin):# Handle Unicode characters in the nametry:- if type(eventData) != unicode:- eventData = unicode(eventData, "utf-8", errors='replace').encode("idna")+ if type(eventData) != str:+ eventData = str(eventData, "utf-8", errors='replace').encode("idna")else:eventData = eventData.encode("idna")except BaseException as e:@@ -183,7 +183,7 @@ class sfp_dnsbrute(SpiderFootPlugin):nextsubs[h + "-0" + str(i) + dom] = Truenextsubs[h + "-00" + str(i) + dom] = True- self.tryHostWrapper(nextsubs.keys(), event)+ self.tryHostWrapper(list(nextsubs.keys()), event)# The rest of the module is for handling targets onlyreturn None@@ -231,13 +231,13 @@ class sfp_dnsbrute(SpiderFootPlugin):nextsubs[s + "-0" + str(i) + dom] = Truenextsubs[s + "-00" + str(i) + dom] = True- if len(nextsubs.keys()) >= self.opts['_maxthreads']:- self.tryHostWrapper(nextsubs.keys(), event)+ if len(list(nextsubs.keys())) >= self.opts['_maxthreads']:+ self.tryHostWrapper(list(nextsubs.keys()), event)nextsubs = dict()# Scan whatever may be left over.if len(nextsubs) > 0:- self.tryHostWrapper(nextsubs.keys(), event)+ self.tryHostWrapper(list(nextsubs.keys()), event)# End of sfp_dnsbrute classdiff --git a/modules/sfp_dnscommonsrv.py b/modules/sfp_dnscommonsrv.pyindex c01a8691..3fe14542 100644--- a/modules/sfp_dnscommonsrv.py+++ b/modules/sfp_dnscommonsrv.py@@ -69,7 +69,7 @@ class sfp_dnscommonsrv(SpiderFootPlugin):self.events = self.tempStorage()self.__dataSource__ = "DNS"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_dnsneighbor.py b/modules/sfp_dnsneighbor.pyindex 07b8ecd5..ea29998b 100644--- a/modules/sfp_dnsneighbor.py+++ b/modules/sfp_dnsneighbor.py@@ -40,7 +40,7 @@ class sfp_dnsneighbor(SpiderFootPlugin):self.hostresults = self.tempStorage()self.__dataSource__ = "DNS"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_dnsraw.py b/modules/sfp_dnsraw.pyindex 58dc6dec..6eb50c2a 100644--- a/modules/sfp_dnsraw.py+++ b/modules/sfp_dnsraw.py@@ -43,7 +43,7 @@ class sfp_dnsraw(SpiderFootPlugin):self.checked = self.tempStorage()self.__dataSource__ = "DNS"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -84,7 +84,7 @@ class sfp_dnsraw(SpiderFootPlugin):'TXT': ['\S+\s+TXT\s+\"(.[^\"]*)"', 'DNS_TEXT']}- for rec in recs.keys():+ for rec in list(recs.keys()):if self.checkForStop():return None@@ -102,7 +102,7 @@ class sfp_dnsraw(SpiderFootPlugin):if str(x) in self.checked:continueself.checked[str(x)] = True- for rx in recs.keys():+ for rx in list(recs.keys()):self.sf.debug("Checking " + str(x) + " + against " + recs[rx][0])pat = re.compile(recs[rx][0], re.IGNORECASE | re.DOTALL)grps = re.findall(pat, str(x))@@ -112,7 +112,7 @@ class sfp_dnsraw(SpiderFootPlugin):for m in grps:self.sf.debug("Matched: " + m)- strdata = unicode(m, 'utf-8', errors='replace')+ strdata = str(m, 'utf-8', errors='replace')evt = SpiderFootEvent(recs[rx][1], strdata,self.__name__, parentEvent)self.notifyListeners(evt)@@ -143,7 +143,7 @@ class sfp_dnsraw(SpiderFootPlugin):evt = SpiderFootEvent(evt_type, domain, self.__name__, parentEvent)self.notifyListeners(evt)- strdata = unicode(str(x), 'utf-8', errors='replace')+ strdata = str(x, 'utf-8', errors='replace')evt = SpiderFootEvent("RAW_DNS_RECORDS", strdata,self.__name__, parentEvent)self.notifyListeners(evt)diff --git a/modules/sfp_dnsresolve.py b/modules/sfp_dnsresolve.pyindex 3908239d..215fd51e 100644--- a/modules/sfp_dnsresolve.py+++ b/modules/sfp_dnsresolve.py@@ -50,7 +50,7 @@ class sfp_dnsresolve(SpiderFootPlugin):self.hostresults = self.tempStorage()self.__dataSource__ = "DNS"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def enrichTarget(self, target):diff --git a/modules/sfp_dnszonexfer.py b/modules/sfp_dnszonexfer.pyindex 84b56e29..22c81787 100644--- a/modules/sfp_dnszonexfer.py+++ b/modules/sfp_dnszonexfer.py@@ -37,7 +37,7 @@ class sfp_dnszonexfer(SpiderFootPlugin):self.events = self.tempStorage()self.__dataSource__ = "DNS"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -97,7 +97,7 @@ class sfp_dnszonexfer(SpiderFootPlugin):try:ret = list()z = dns.zone.from_xfr(dns.query.xfr(nsip, name))- names = z.nodes.keys()+ names = list(z.nodes.keys())for n in names:ret.append(z[n].to_text(n))diff --git a/modules/sfp_dronebl.py b/modules/sfp_dronebl.pyindex 8b70b49e..2067a04b 100644--- a/modules/sfp_dronebl.py+++ b/modules/sfp_dronebl.py@@ -64,7 +64,7 @@ class sfp_dronebl(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -104,7 +104,7 @@ class sfp_dronebl(SpiderFootPlugin):text = self.checks[domain] + " (" + qaddr + ")"breakelse:- if str(addr) not in self.checks[domain].keys():+ if str(addr) not in list(self.checks[domain].keys()):self.sf.debug("Return code not found in list: " + str(addr))continuediff --git a/modules/sfp_duckduckgo.py b/modules/sfp_duckduckgo.pyindex 40402ea2..26e96f82 100644--- a/modules/sfp_duckduckgo.py+++ b/modules/sfp_duckduckgo.py@@ -32,7 +32,7 @@ class sfp_duckduckgo(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_email.py b/modules/sfp_email.pyindex b8d5a2e8..cd487cdd 100644--- a/modules/sfp_email.py+++ b/modules/sfp_email.py@@ -33,7 +33,7 @@ class sfp_email(SpiderFootPlugin):def setup(self, sfc, userOpts=dict()):self.sf = sfc- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -76,7 +76,7 @@ class sfp_email(SpiderFootPlugin):self.sf.info("Found e-mail address: " + email)if type(email) == str:- mail = unicode(email.strip('.'), 'utf-8', errors='replace')+ mail = str(email.strip('.'), 'utf-8', errors='replace')else:mail = email.strip('.')diff --git a/modules/sfp_emailformat.py b/modules/sfp_emailformat.pyindex c7dae576..f118a40b 100644--- a/modules/sfp_emailformat.py+++ b/modules/sfp_emailformat.py@@ -37,7 +37,7 @@ class sfp_emailformat(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_emailrep.py b/modules/sfp_emailrep.pyindex 3996e484..2efd2a67 100644--- a/modules/sfp_emailrep.py+++ b/modules/sfp_emailrep.py@@ -31,7 +31,7 @@ class sfp_emailrep(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def watchedEvents(self):diff --git a/modules/sfp_errors.py b/modules/sfp_errors.pyindex e251f3a5..4e92f9e4 100644--- a/modules/sfp_errors.py+++ b/modules/sfp_errors.py@@ -50,7 +50,7 @@ class sfp_errors(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -78,7 +78,7 @@ class sfp_errors(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)- if eventSource not in self.results.keys():+ if eventSource not in list(self.results.keys()):self.results[eventSource] = list()# We only want web content for pages on the target site@@ -86,7 +86,7 @@ class sfp_errors(SpiderFootPlugin):self.sf.debug("Not collecting web content information for external sites.")return None- for regexpGrp in regexps.keys():+ for regexpGrp in list(regexps.keys()):if regexpGrp in self.results[eventSource]:continuediff --git a/modules/sfp_ethereum.py b/modules/sfp_ethereum.pyindex cfce62d1..dbcc3388 100644--- a/modules/sfp_ethereum.py+++ b/modules/sfp_ethereum.py@@ -30,7 +30,7 @@ class sfp_ethereum(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_filemeta.py b/modules/sfp_filemeta.pyindex b9d0cdba..bfd00b8a 100644--- a/modules/sfp_filemeta.py+++ b/modules/sfp_filemeta.py@@ -42,7 +42,7 @@ class sfp_filemeta(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -112,7 +112,7 @@ class sfp_filemeta(SpiderFootPlugin):self.sf.debug("Office type: " + str(mtype))a = doc.core_properties.authorc = doc.core_properties.comments- data = filter(None, [a, c])+ data = [_f for _f in [a, c] if _f]meta = ", ".join(data)except BaseException as e:self.sf.error("Unable to process file: " +@@ -127,7 +127,7 @@ class sfp_filemeta(SpiderFootPlugin):self.sf.debug("Office type: " + str(mtype))a = doc.core_properties.authorc = doc.core_properties.comments- data = filter(None, [a, c])+ data = [_f for _f in [a, c] if _f]meta = ", ".join(data)except BaseException as e:self.sf.error("Unable to process file: " +diff --git a/modules/sfp_flickr.py b/modules/sfp_flickr.pyindex b8908050..3b0a1e8d 100644--- a/modules/sfp_flickr.py+++ b/modules/sfp_flickr.py@@ -44,7 +44,7 @@ class sfp_flickr(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_fortinet.py b/modules/sfp_fortinet.pyindex 32e239d5..9e664d3a 100644--- a/modules/sfp_fortinet.py+++ b/modules/sfp_fortinet.py@@ -57,7 +57,7 @@ class sfp_fortinet(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -96,10 +96,10 @@ class sfp_fortinet(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -118,7 +118,7 @@ class sfp_fortinet(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -176,8 +176,8 @@ class sfp_fortinet(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -190,7 +190,7 @@ class sfp_fortinet(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -222,7 +222,7 @@ class sfp_fortinet(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_fraudguard.py b/modules/sfp_fraudguard.pyindex c6d0ea6e..a1a60cbf 100644--- a/modules/sfp_fraudguard.py+++ b/modules/sfp_fraudguard.py@@ -52,7 +52,7 @@ class sfp_fraudguard(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_fringeproject.py b/modules/sfp_fringeproject.pyindex e5917c8b..a514b0ee 100644--- a/modules/sfp_fringeproject.py+++ b/modules/sfp_fringeproject.py@@ -17,7 +17,7 @@ except ImportError as e:import reimport time-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_fringeproject(SpiderFootPlugin):@@ -36,7 +36,7 @@ class sfp_fringeproject(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def watchedEvents(self):@@ -51,7 +51,7 @@ class sfp_fringeproject(SpiderFootPlugin):'q': qry.encode('raw_unicode_escape')}- res = self.sf.fetchUrl('https://api.fringeproject.com/api/search?' + urllib.urlencode(params),+ res = self.sf.fetchUrl('https://api.fringeproject.com/api/search?' + urllib.parse.urlencode(params),useragent=self.opts['_useragent'],timeout=self.opts['_fetchtimeout'])diff --git a/modules/sfp_fsecure_riddler.py b/modules/sfp_fsecure_riddler.pyindex d4fada1e..868fbceb 100644--- a/modules/sfp_fsecure_riddler.py+++ b/modules/sfp_fsecure_riddler.py@@ -37,7 +37,7 @@ class sfp_fsecure_riddler(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def watchedEvents(self):diff --git a/modules/sfp_fullcontact.py b/modules/sfp_fullcontact.pyindex 8f841c0c..bf3f2c2c 100644--- a/modules/sfp_fullcontact.py+++ b/modules/sfp_fullcontact.py@@ -44,7 +44,7 @@ class sfp_fullcontact(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -130,7 +130,7 @@ class sfp_fullcontact(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)# Don't look up stuff twice- if self.results.has_key(eventData):+ if eventData in self.results:self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneelse:diff --git a/modules/sfp_github.py b/modules/sfp_github.pyindex 90cb87c8..1944a2df 100644--- a/modules/sfp_github.py+++ b/modules/sfp_github.py@@ -31,7 +31,7 @@ class sfp_github(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_googlemaps.py b/modules/sfp_googlemaps.pyindex 57c625e0..6a7a1d11 100644--- a/modules/sfp_googlemaps.py+++ b/modules/sfp_googlemaps.py@@ -34,7 +34,7 @@ class sfp_googlemaps(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_googlesearch.py b/modules/sfp_googlesearch.pyindex 298c1bf9..fe91bb69 100644--- a/modules/sfp_googlesearch.py+++ b/modules/sfp_googlesearch.py@@ -38,7 +38,7 @@ class sfp_googlesearch(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_gravatar.py b/modules/sfp_gravatar.pyindex e96e7438..2e4e909f 100644--- a/modules/sfp_gravatar.py+++ b/modules/sfp_gravatar.py@@ -36,7 +36,7 @@ class sfp_gravatar(SpiderFootPlugin):self.results = self.tempStorage()self.reportedUsers = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_greynoise.py b/modules/sfp_greynoise.pyindex a15fd35b..65a9cfd5 100644--- a/modules/sfp_greynoise.py+++ b/modules/sfp_greynoise.py@@ -55,7 +55,7 @@ class sfp_greynoise(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_h1nobbdde.py b/modules/sfp_h1nobbdde.pyindex d67e4d21..8737ccf0 100644--- a/modules/sfp_h1nobbdde.py+++ b/modules/sfp_h1nobbdde.py@@ -39,7 +39,7 @@ class sfp_h1nobbdde(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def watchedEvents(self):@@ -79,7 +79,7 @@ class sfp_h1nobbdde(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)- if self.results.has_key(eventData):+ if eventData in self.results:self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneelse:diff --git a/modules/sfp_hackertarget.py b/modules/sfp_hackertarget.pyindex add48bec..cda46dbb 100644--- a/modules/sfp_hackertarget.py+++ b/modules/sfp_hackertarget.py@@ -58,7 +58,7 @@ class sfp_hackertarget(SpiderFootPlugin):self.results = self.tempStorage()self.cohostcount = 0- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_haveibeenpwned.py b/modules/sfp_haveibeenpwned.pyindex e67d8d93..d1bfce6c 100644--- a/modules/sfp_haveibeenpwned.py+++ b/modules/sfp_haveibeenpwned.py@@ -41,7 +41,7 @@ class sfp_haveibeenpwned(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_honeypot.py b/modules/sfp_honeypot.pyindex d21c93de..b0855c0f 100644--- a/modules/sfp_honeypot.py+++ b/modules/sfp_honeypot.py@@ -66,7 +66,7 @@ class sfp_honeypot(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_hosting.py b/modules/sfp_hosting.pyindex 784fa297..0d09d829 100644--- a/modules/sfp_hosting.py+++ b/modules/sfp_hosting.py@@ -35,7 +35,7 @@ class sfp_hosting(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "DNS"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_hostsfilenet.py b/modules/sfp_hostsfilenet.pyindex 0d686306..0510042b 100644--- a/modules/sfp_hostsfilenet.py+++ b/modules/sfp_hostsfilenet.py@@ -52,7 +52,7 @@ class sfp_hostsfilenet(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -74,7 +74,7 @@ class sfp_hostsfilenet(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -88,8 +88,8 @@ class sfp_hostsfilenet(SpiderFootPlugin):else:self.sf.cachePut("sfmal_" + cid, data['content'])- if type(data['content']) != unicode:- data['content'] = unicode(data['content'], 'utf-8', errors='replace')+ if type(data['content']) != str:+ data['content'] = str(data['content'], 'utf-8', errors='replace')# Check for the domain and the hostnameif targetType == "domain" and "127.0.0.1\t" + targetDom + "\n" in data['content']:@@ -101,7 +101,7 @@ class sfp_hostsfilenet(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -131,7 +131,7 @@ class sfp_hostsfilenet(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_hunter.py b/modules/sfp_hunter.pyindex 23304060..b5db216d 100644--- a/modules/sfp_hunter.py+++ b/modules/sfp_hunter.py@@ -40,7 +40,7 @@ class sfp_hunter(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -85,7 +85,7 @@ class sfp_hunter(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)# Don't look up stuff twice- if self.results.has_key(eventData):+ if eventData in self.results:self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneelse:diff --git a/modules/sfp_iknowwhatyoudownload.py b/modules/sfp_iknowwhatyoudownload.pyindex 6a69344e..c474b6b2 100644--- a/modules/sfp_iknowwhatyoudownload.py+++ b/modules/sfp_iknowwhatyoudownload.py@@ -42,7 +42,7 @@ class sfp_iknowwhatyoudownload(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_instagram.py b/modules/sfp_instagram.pyindex 3abc7e52..7e38fc63 100644--- a/modules/sfp_instagram.py+++ b/modules/sfp_instagram.py@@ -34,7 +34,7 @@ class sfp_instagram(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_intelx.py b/modules/sfp_intelx.pyindex c5d3eba8..c3519e85 100644--- a/modules/sfp_intelx.py+++ b/modules/sfp_intelx.py@@ -60,7 +60,7 @@ class sfp_intelx(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_intfiles.py b/modules/sfp_intfiles.pyindex cc248c52..6466b2a0 100644--- a/modules/sfp_intfiles.py+++ b/modules/sfp_intfiles.py@@ -32,7 +32,7 @@ class sfp_intfiles(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_ipinfo.py b/modules/sfp_ipinfo.pyindex 31bde5d2..189aab5b 100644--- a/modules/sfp_ipinfo.py+++ b/modules/sfp_ipinfo.py@@ -34,7 +34,7 @@ class sfp_ipinfo(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -105,7 +105,7 @@ class sfp_ipinfo(SpiderFootPlugin):if 'country' not in data:return None- location = ', '.join(filter(None, [data.get('city'), data.get('region'), data.get('country')]))+ location = ', '.join([_f for _f in [data.get('city'), data.get('region'), data.get('country')] if _f])self.sf.info("Found GeoIP for " + eventData + ": " + location)evt = SpiderFootEvent("GEOINFO", location, self.__name__, event)diff --git a/modules/sfp_ipstack.py b/modules/sfp_ipstack.pyindex 03ed0274..5eac3a7e 100644--- a/modules/sfp_ipstack.py+++ b/modules/sfp_ipstack.py@@ -33,7 +33,7 @@ class sfp_ipstack(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_isc.py b/modules/sfp_isc.pyindex e122bc5e..d698f773 100644--- a/modules/sfp_isc.py+++ b/modules/sfp_isc.py@@ -57,7 +57,7 @@ class sfp_isc(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -94,10 +94,10 @@ class sfp_isc(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=30, useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -116,7 +116,7 @@ class sfp_isc(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -174,8 +174,8 @@ class sfp_isc(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -188,7 +188,7 @@ class sfp_isc(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -220,7 +220,7 @@ class sfp_isc(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_junkfiles.py b/modules/sfp_junkfiles.pyindex ab592eb8..5434032d 100644--- a/modules/sfp_junkfiles.py+++ b/modules/sfp_junkfiles.py@@ -48,7 +48,7 @@ class sfp_junkfiles(SpiderFootPlugin):self.bases = self.tempStorage()self.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_malc0de.py b/modules/sfp_malc0de.pyindex 28d82968..83cccccc 100644--- a/modules/sfp_malc0de.py+++ b/modules/sfp_malc0de.py@@ -61,7 +61,7 @@ class sfp_malc0de(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -100,10 +100,10 @@ class sfp_malc0de(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -122,7 +122,7 @@ class sfp_malc0de(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -180,8 +180,8 @@ class sfp_malc0de(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -194,7 +194,7 @@ class sfp_malc0de(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -230,7 +230,7 @@ class sfp_malc0de(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_malwaredomainlist.py b/modules/sfp_malwaredomainlist.pyindex 54e0300f..c2dec666 100644--- a/modules/sfp_malwaredomainlist.py+++ b/modules/sfp_malwaredomainlist.py@@ -71,7 +71,7 @@ class sfp_malwaredomainlist(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -112,10 +112,10 @@ class sfp_malwaredomainlist(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -134,7 +134,7 @@ class sfp_malwaredomainlist(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -192,8 +192,8 @@ class sfp_malwaredomainlist(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -206,7 +206,7 @@ class sfp_malwaredomainlist(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -242,7 +242,7 @@ class sfp_malwaredomainlist(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_malwaredomains.py b/modules/sfp_malwaredomains.pyindex 92af6f06..b5f006f5 100644--- a/modules/sfp_malwaredomains.py+++ b/modules/sfp_malwaredomains.py@@ -59,7 +59,7 @@ class sfp_malwaredomains(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -97,10 +97,10 @@ class sfp_malwaredomains(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -119,7 +119,7 @@ class sfp_malwaredomains(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -177,8 +177,8 @@ class sfp_malwaredomains(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -191,7 +191,7 @@ class sfp_malwaredomains(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -223,7 +223,7 @@ class sfp_malwaredomains(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_malwarepatrol.py b/modules/sfp_malwarepatrol.pyindex 614d5a32..81f0f632 100644--- a/modules/sfp_malwarepatrol.py+++ b/modules/sfp_malwarepatrol.py@@ -31,7 +31,7 @@ class sfp_malwarepatrol(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_metadefender.py b/modules/sfp_metadefender.pyindex 9c7a8b49..d4ac81a0 100644--- a/modules/sfp_metadefender.py+++ b/modules/sfp_metadefender.py@@ -40,7 +40,7 @@ class sfp_metadefender(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -142,7 +142,7 @@ class sfp_metadefender(SpiderFootPlugin):geo_info = data.get('geo_info')if geo_info:- location = ', '.join(filter(None, [geo_info.get('city').get('name'), geo_info.get('country').get('name')]))+ location = ', '.join([_f for _f in [geo_info.get('city').get('name'), geo_info.get('country').get('name')] if _f])evt = SpiderFootEvent('GEOINFO', location, self.__name__, event)self.notifyListeners(evt)diff --git a/modules/sfp_mnemonic.py b/modules/sfp_mnemonic.pyindex b25cce48..523021dd 100644--- a/modules/sfp_mnemonic.py+++ b/modules/sfp_mnemonic.py@@ -13,7 +13,7 @@import jsonimport time-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_mnemonic(SpiderFootPlugin):@@ -51,7 +51,7 @@ class sfp_mnemonic(SpiderFootPlugin):self.cohostcount = 0self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -71,7 +71,7 @@ class sfp_mnemonic(SpiderFootPlugin):'offset': str(offset)}- url = 'https://api.mnemonic.no/pdns/v3/' + qry + '?' + urllib.urlencode(params)+ url = 'https://api.mnemonic.no/pdns/v3/' + qry + '?' + urllib.parse.urlencode(params)res = self.sf.fetchUrl(url, timeout=self.opts['timeout'], useragent=self.opts['_useragent'])# Unauthenticated users are limited to 100 requests per minute, and 1000 requests per day.diff --git a/modules/sfp_multiproxy.py b/modules/sfp_multiproxy.pyindex e9e8f27a..f10b037c 100644--- a/modules/sfp_multiproxy.py+++ b/modules/sfp_multiproxy.py@@ -58,7 +58,7 @@ class sfp_multiproxy(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -96,10 +96,10 @@ class sfp_multiproxy(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -118,7 +118,7 @@ class sfp_multiproxy(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -176,8 +176,8 @@ class sfp_multiproxy(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -190,7 +190,7 @@ class sfp_multiproxy(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -222,7 +222,7 @@ class sfp_multiproxy(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_myspace.py b/modules/sfp_myspace.pyindex 90a65d30..ab7748d9 100644--- a/modules/sfp_myspace.py+++ b/modules/sfp_myspace.py@@ -34,7 +34,7 @@ class sfp_myspace(SpiderFootPlugin):self.__dataSource__ = "MySpace.com"self.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_names.py b/modules/sfp_names.pyindex f44d2344..d94215ef 100644--- a/modules/sfp_names.py+++ b/modules/sfp_names.py@@ -44,7 +44,7 @@ class sfp_names(SpiderFootPlugin):self.d = set(self.sf.dictwords())self.n = set(self.sf.dictnames())- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -78,11 +78,11 @@ class sfp_names(SpiderFootPlugin):if eventName == "EMAILADDR" and self.opts['emailtoname']:if "." in eventData.split("@")[0]:- if type(eventData) == unicode:- name = " ".join(map(unicode.capitalize, eventData.split("@")[0].split(".")))+ if type(eventData) == str:+ name = " ".join(map(str.capitalize, eventData.split("@")[0].split(".")))else:name = " ".join(map(str.capitalize, eventData.split("@")[0].split(".")))- name = unicode(name, 'utf-8', errors='replace')+ name = str(name, 'utf-8', errors='replace')# Names don't have numbersif re.match("[0-9]", name):diff --git a/modules/sfp_neutrinoapi.py b/modules/sfp_neutrinoapi.pyindex e46a7c5d..db970f54 100644--- a/modules/sfp_neutrinoapi.py+++ b/modules/sfp_neutrinoapi.py@@ -41,7 +41,7 @@ class sfp_neutrinoapi(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_norton.py b/modules/sfp_norton.pyindex ed462b8c..1205e940 100644--- a/modules/sfp_norton.py+++ b/modules/sfp_norton.py@@ -32,7 +32,7 @@ class sfp_norton(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_nothink.py b/modules/sfp_nothink.pyindex df53f38d..e12a2c86 100644--- a/modules/sfp_nothink.py+++ b/modules/sfp_nothink.py@@ -78,7 +78,7 @@ class sfp_nothink(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -119,10 +119,10 @@ class sfp_nothink(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -141,7 +141,7 @@ class sfp_nothink(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -199,8 +199,8 @@ class sfp_nothink(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -213,7 +213,7 @@ class sfp_nothink(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -249,7 +249,7 @@ class sfp_nothink(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_numpi.py b/modules/sfp_numpi.pyindex a43bd5ed..0d8e80d1 100644--- a/modules/sfp_numpi.py+++ b/modules/sfp_numpi.py@@ -38,7 +38,7 @@ class sfp_numpi(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -145,7 +145,7 @@ class sfp_numpi(SpiderFootPlugin):else:self.sf.debug("No carrier information found for " + eventData)- location = ', '.join(filter(None, [data.get('City'), data.get('County'), data.get('State'), data.get('ZIP Code')]))+ location = ', '.join([_f for _f in [data.get('City'), data.get('County'), data.get('State'), data.get('ZIP Code')] if _f])if location:evt = SpiderFootEvent('GEOINFO', location, self.__name__, event)self.notifyListeners(evt)diff --git a/modules/sfp_numverify.py b/modules/sfp_numverify.pyindex 82f3ba20..6278a744 100644--- a/modules/sfp_numverify.py+++ b/modules/sfp_numverify.py@@ -11,7 +11,7 @@#-------------------------------------------------------------------------------import json-import urllib+import urllib.request, urllib.parse, urllib.errorimport timefrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent@@ -37,7 +37,7 @@ class sfp_numverify(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -61,7 +61,7 @@ class sfp_numverify(SpiderFootPlugin):}# Free API does not support HTTPS for no adequately explained reason- res = self.sf.fetchUrl("http://apilayer.net/api/validate?" + urllib.urlencode(params),+ res = self.sf.fetchUrl("http://apilayer.net/api/validate?" + urllib.parse.urlencode(params),timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'])@@ -129,7 +129,7 @@ class sfp_numverify(SpiderFootPlugin):self.notifyListeners(evt)if data.get('country_code') is not None:- location = ', '.join(filter(None, [data.get('location'), data.get('country_code')]))+ location = ', '.join([_f for _f in [data.get('location'), data.get('country_code')] if _f])evt = SpiderFootEvent("GEOINFO", location, self.__name__, event)self.notifyListeners(evt)else:diff --git a/modules/sfp_onioncity.py b/modules/sfp_onioncity.pyindex 7ac9234a..641bc432 100644--- a/modules/sfp_onioncity.py+++ b/modules/sfp_onioncity.py@@ -44,7 +44,7 @@ class sfp_onioncity(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_onionsearchengine.py b/modules/sfp_onionsearchengine.pyindex 370950cc..6de156f4 100644--- a/modules/sfp_onionsearchengine.py+++ b/modules/sfp_onionsearchengine.py@@ -16,7 +16,7 @@ try:except ImportError as e:import re-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_onionsearchengine(SpiderFootPlugin):@@ -44,7 +44,7 @@ class sfp_onionsearchengine(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -82,7 +82,7 @@ class sfp_onionsearchengine(SpiderFootPlugin):}# Sites hosted on the domain- data = self.sf.fetchUrl('https://onionsearchengine.com/search.php?' + urllib.urlencode(params),+ data = self.sf.fetchUrl('https://onionsearchengine.com/search.php?' + urllib.parse.urlencode(params),useragent=self.opts['_useragent'],timeout=self.opts['timeout'])diff --git a/modules/sfp_openbugbounty.py b/modules/sfp_openbugbounty.pyindex 34786b99..87279b38 100644--- a/modules/sfp_openbugbounty.py+++ b/modules/sfp_openbugbounty.py@@ -41,7 +41,7 @@ class sfp_openbugbounty(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -86,7 +86,7 @@ class sfp_openbugbounty(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)# Don't look up stuff twice- if self.results.has_key(eventData):+ if eventData in self.results:self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneelse:diff --git a/modules/sfp_opencorporates.py b/modules/sfp_opencorporates.pyindex d12afffc..e568bfeb 100644--- a/modules/sfp_opencorporates.py+++ b/modules/sfp_opencorporates.py@@ -36,7 +36,7 @@ class sfp_opencorporates(SpiderFootPlugin):self.__dataSource__ = "OpenCorporates"self.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -50,9 +50,6 @@ class sfp_opencorporates(SpiderFootPlugin):# Search for company name# https://api.opencorporates.com/documentation/API-Referencedef searchCompany(self, qry):- if type(qry) != unicode:- qry = qry.encode("utf-8", errors="replace")-apiparam = ""if not self.opts['api_key'] == "":apiparam = "&api_token=" + self.opts['api_key']diff --git a/modules/sfp_opendns.py b/modules/sfp_opendns.pyindex 3d1ae70d..00fd673b 100644--- a/modules/sfp_opendns.py+++ b/modules/sfp_opendns.py@@ -32,7 +32,7 @@ class sfp_opendns(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_openphish.py b/modules/sfp_openphish.pyindex af79aa02..55dfa09c 100644--- a/modules/sfp_openphish.py+++ b/modules/sfp_openphish.py@@ -60,7 +60,7 @@ class sfp_openphish(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -98,10 +98,10 @@ class sfp_openphish(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -120,7 +120,7 @@ class sfp_openphish(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -178,8 +178,8 @@ class sfp_openphish(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -192,7 +192,7 @@ class sfp_openphish(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -224,7 +224,7 @@ class sfp_openphish(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_openstreetmap.py b/modules/sfp_openstreetmap.pyindex f4518d10..3034ce58 100644--- a/modules/sfp_openstreetmap.py+++ b/modules/sfp_openstreetmap.py@@ -17,7 +17,7 @@ except ImportError as e:import reimport jsonimport time-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_openstreetmap(SpiderFootPlugin):@@ -35,7 +35,7 @@ class sfp_openstreetmap(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -56,7 +56,7 @@ class sfp_openstreetmap(SpiderFootPlugin):'addressdetails': '0'}- res = self.sf.fetchUrl("https://nominatim.openstreetmap.org/search?" + urllib.urlencode(params),+ res = self.sf.fetchUrl("https://nominatim.openstreetmap.org/search?" + urllib.parse.urlencode(params),timeout=self.opts['_fetchtimeout'], useragent='SpiderFoot')if res['content'] is None:diff --git a/modules/sfp_pageinfo.py b/modules/sfp_pageinfo.pyindex 8ed58d0e..9b146dfc 100644--- a/modules/sfp_pageinfo.py+++ b/modules/sfp_pageinfo.py@@ -44,7 +44,7 @@ class sfp_pageinfo(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_pastebin.py b/modules/sfp_pastebin.pyindex e357af8e..1d8bd439 100644--- a/modules/sfp_pastebin.py+++ b/modules/sfp_pastebin.py@@ -47,7 +47,7 @@ class sfp_pastebin(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -78,7 +78,7 @@ class sfp_pastebin(SpiderFootPlugin):else:self.results[eventData] = True- for dom in self.domains.keys():+ for dom in list(self.domains.keys()):links = list()target = self.domains[dom]res = self.sf.googleIterate(diff --git a/modules/sfp_pgp.py b/modules/sfp_pgp.pyindex 0c598d27..07bdd0ed 100644--- a/modules/sfp_pgp.py+++ b/modules/sfp_pgp.py@@ -47,7 +47,7 @@ class sfp_pgp(SpiderFootPlugin):self.__dataSource__ = "PGP Key Servers"self.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_phishtank.py b/modules/sfp_phishtank.pyindex f055b853..4dba945c 100644--- a/modules/sfp_phishtank.py+++ b/modules/sfp_phishtank.py@@ -60,7 +60,7 @@ class sfp_phishtank(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -98,10 +98,10 @@ class sfp_phishtank(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -120,7 +120,7 @@ class sfp_phishtank(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -178,8 +178,8 @@ class sfp_phishtank(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -192,7 +192,7 @@ class sfp_phishtank(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -224,7 +224,7 @@ class sfp_phishtank(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_phone.py b/modules/sfp_phone.pyindex 6e58f4c7..c9c1a769 100644--- a/modules/sfp_phone.py+++ b/modules/sfp_phone.py@@ -31,7 +31,7 @@ class sfp_phone(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_portscan_tcp.py b/modules/sfp_portscan_tcp.pyindex 9dbb27af..cc027f5b 100644--- a/modules/sfp_portscan_tcp.py+++ b/modules/sfp_portscan_tcp.py@@ -59,7 +59,7 @@ class sfp_portscan_tcp(SpiderFootPlugin):self.__dataSource__ = "Target Network"self.lock = threading.Lock()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]if self.opts['ports'][0].startswith("http://") or \diff --git a/modules/sfp_psbdmp.py b/modules/sfp_psbdmp.pyindex d563c97b..056e2f69 100644--- a/modules/sfp_psbdmp.py+++ b/modules/sfp_psbdmp.py@@ -41,7 +41,7 @@ class sfp_psbdmp(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -98,7 +98,7 @@ class sfp_psbdmp(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)# Don't look up stuff twice- if self.results.has_key(eventData):+ if eventData in self.results:self.sf.debug("Skipping " + eventData + " as already mapped.")return Noneelse:diff --git a/modules/sfp_pulsedive.py b/modules/sfp_pulsedive.pyindex d7b23f82..38f8b2aa 100644--- a/modules/sfp_pulsedive.py+++ b/modules/sfp_pulsedive.py@@ -14,7 +14,7 @@ import jsonfrom datetime import datetimeimport timefrom netaddr import IPNetwork-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_pulsedive(SpiderFootPlugin):@@ -56,7 +56,7 @@ class sfp_pulsedive(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -77,7 +77,7 @@ class sfp_pulsedive(SpiderFootPlugin):'key': self.opts['api_key']}- url = 'https://pulsedive.com/api/info.php?' + urllib.urlencode(params)+ url = 'https://pulsedive.com/api/info.php?' + urllib.parse.urlencode(params)res = self.sf.fetchUrl(url, timeout=30, useragent="SpiderFoot")time.sleep(self.opts['delay'])diff --git a/modules/sfp_quad9.py b/modules/sfp_quad9.pyindex 0ee5b0cd..8b46d4d0 100644--- a/modules/sfp_quad9.py+++ b/modules/sfp_quad9.py@@ -32,7 +32,7 @@ class sfp_quad9(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_ripe.py b/modules/sfp_ripe.pyindex bf653e51..bf121978 100644--- a/modules/sfp_ripe.py+++ b/modules/sfp_ripe.py@@ -42,7 +42,7 @@ class sfp_ripe(SpiderFootPlugin):self.nbreported = self.tempStorage()self.lastContent = None- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -236,7 +236,7 @@ class sfp_ripe(SpiderFootPlugin):owned = Falseif ownerinfo is not None:- for k in ownerinfo.keys():+ for k in list(ownerinfo.keys()):items = ownerinfo[k]for item in items:if self.findName(item.lower()):@@ -273,7 +273,7 @@ class sfp_ripe(SpiderFootPlugin):ownerinfo = self.asOwnerInfo(nasn)ownertext = ''if ownerinfo is not None:- for k, v in ownerinfo.iteritems():+ for k, v in ownerinfo.items():ownertext = ownertext + k + ": " + ', '.join(v) + "\n"if len(ownerinfo) > 0:diff --git a/modules/sfp_riskiq.py b/modules/sfp_riskiq.pyindex 455a9280..c5fe9595 100644--- a/modules/sfp_riskiq.py+++ b/modules/sfp_riskiq.py@@ -51,7 +51,7 @@ class sfp_riskiq(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_robtex.py b/modules/sfp_robtex.pyindex 262b5841..c0be46ac 100644--- a/modules/sfp_robtex.py+++ b/modules/sfp_robtex.py@@ -46,7 +46,7 @@ class sfp_robtex(SpiderFootPlugin):self.results = self.tempStorage()self.cohostcount = 0- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_s3bucket.py b/modules/sfp_s3bucket.pyindex 4d2d0ced..6ffb722e 100644--- a/modules/sfp_s3bucket.py+++ b/modules/sfp_s3bucket.py@@ -42,7 +42,7 @@ class sfp_s3bucket(SpiderFootPlugin):self.results = self.tempStorage()self.lock = threading.Lock()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -112,7 +112,7 @@ class sfp_s3bucket(SpiderFootPlugin):if data == None:return res- for ret in data.keys():+ for ret in list(data.keys()):if data[ret]:# bucket:filecountres.append(ret + ":" + str(data[ret]))diff --git a/modules/sfp_scylla.py b/modules/sfp_scylla.pyindex cb5f0c9d..ba3f9cb4 100644--- a/modules/sfp_scylla.py+++ b/modules/sfp_scylla.py@@ -11,7 +11,7 @@import jsonimport time-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_scylla(SpiderFootPlugin):@@ -39,7 +39,7 @@ class sfp_scylla(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -61,7 +61,7 @@ class sfp_scylla(SpiderFootPlugin):headers = {'Accept': 'application/json',}- res = self.sf.fetchUrl('https://scylla.sh/search?' + urllib.urlencode(params),+ res = self.sf.fetchUrl('https://scylla.sh/search?' + urllib.parse.urlencode(params),headers=headers,timeout=15,useragent=self.opts['_useragent'])diff --git a/modules/sfp_securitytrails.py b/modules/sfp_securitytrails.pyindex 5862a0f9..ea4b1f7a 100644--- a/modules/sfp_securitytrails.py+++ b/modules/sfp_securitytrails.py@@ -48,7 +48,7 @@ class sfp_securitytrails(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_shodan.py b/modules/sfp_shodan.pyindex 0e03841e..4be4e4d6 100644--- a/modules/sfp_shodan.py+++ b/modules/sfp_shodan.py@@ -11,7 +11,7 @@# -------------------------------------------------------------------------------import json-import urllib+import urllib.request, urllib.parse, urllib.errorfrom netaddr import IPNetworkfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent@@ -44,7 +44,7 @@ class sfp_shodan(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -96,7 +96,7 @@ class sfp_shodan(SpiderFootPlugin):'key': self.opts['api_key']}- res = self.sf.fetchUrl("https://api.shodan.io/shodan/host/search?" + urllib.urlencode(params),+ res = self.sf.fetchUrl("https://api.shodan.io/shodan/host/search?" + urllib.parse.urlencode(params),timeout=self.opts['_fetchtimeout'], useragent="SpiderFoot")if res['content'] is None:self.sf.info("No SHODAN info found for " + qry)@@ -205,7 +205,7 @@ class sfp_shodan(SpiderFootPlugin):self.notifyListeners(evt)if rec.get('country_name') is not None:- location = ', '.join(filter(None, [rec.get('city'), rec.get('country_name')]))+ location = ', '.join([_f for _f in [rec.get('city'), rec.get('country_name')] if _f])evt = SpiderFootEvent("GEOINFO", location, self.__name__, event)self.notifyListeners(evt)@@ -242,7 +242,7 @@ class sfp_shodan(SpiderFootPlugin):self.notifyListeners(evt)if vulns is not None:- for vuln in vulns.keys():+ for vuln in list(vulns.keys()):evt = SpiderFootEvent('VULNERABILITY', vuln,self.__name__, event)self.notifyListeners(evt)diff --git a/modules/sfp_similar.py b/modules/sfp_similar.pyindex 4c037644..5e49c19e 100644--- a/modules/sfp_similar.py+++ b/modules/sfp_similar.py@@ -77,7 +77,7 @@ class sfp_similar(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "DNS"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_skymem.py b/modules/sfp_skymem.pyindex 5f0ed84b..bcf29f95 100644--- a/modules/sfp_skymem.py+++ b/modules/sfp_skymem.py@@ -37,7 +37,7 @@ class sfp_skymem(SpiderFootPlugin):self.__dataSource__ = "Skymem"self.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_slideshare.py b/modules/sfp_slideshare.pyindex b31f5e2c..91c4dd2c 100644--- a/modules/sfp_slideshare.py+++ b/modules/sfp_slideshare.py@@ -32,7 +32,7 @@ class sfp_slideshare(SpiderFootPlugin):self.__dataSource__ = "SlideShare"self.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_social.py b/modules/sfp_social.pyindex dd9354d2..c61806f7 100644--- a/modules/sfp_social.py+++ b/modules/sfp_social.py@@ -53,7 +53,7 @@ class sfp_social(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -75,12 +75,12 @@ class sfp_social(SpiderFootPlugin):self.sf.debug("Received event, " + eventName + ", from " + srcModuleName)- if eventData not in self.results.keys():+ if eventData not in list(self.results.keys()):self.results[eventData] = Trueelse:return None- for regexpGrp in regexps.keys():+ for regexpGrp in list(regexps.keys()):for regex in regexps[regexpGrp]:bits = re.match(regex, eventData, re.IGNORECASE)if bits is not None:diff --git a/modules/sfp_socialprofiles.py b/modules/sfp_socialprofiles.pyindex 3f4c2c49..7fe9206a 100644--- a/modules/sfp_socialprofiles.py+++ b/modules/sfp_socialprofiles.py@@ -78,7 +78,7 @@ class sfp_socialprofiles(SpiderFootPlugin):self.keywords = Noneself.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -123,7 +123,7 @@ class sfp_socialprofiles(SpiderFootPlugin):self.keywords = Nonefor site in sites:- s = unicode(sites[site][0]).format(name=eventData)+ s = str(sites[site][0]).format(name=eventData)searchStr = s.replace(" ", "%20")res = Nonediff --git a/modules/sfp_sorbs.py b/modules/sfp_sorbs.pyindex 6d8935f2..92aebb89 100644--- a/modules/sfp_sorbs.py+++ b/modules/sfp_sorbs.py@@ -57,7 +57,7 @@ class sfp_sorbs(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -98,7 +98,7 @@ class sfp_sorbs(SpiderFootPlugin):text = self.checks[domain] + " (" + qaddr + ")"breakelse:- if str(addr) not in self.checks[domain].keys():+ if str(addr) not in list(self.checks[domain].keys()):self.sf.debug("Return code not found in list: " + str(addr))continuediff --git a/modules/sfp_spamcop.py b/modules/sfp_spamcop.pyindex 0794a500..a1f5611c 100644--- a/modules/sfp_spamcop.py+++ b/modules/sfp_spamcop.py@@ -51,7 +51,7 @@ class sfp_spamcop(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -92,7 +92,7 @@ class sfp_spamcop(SpiderFootPlugin):text = self.checks[domain] + " (" + qaddr + ")"breakelse:- if str(addr) not in self.checks[domain].keys():+ if str(addr) not in list(self.checks[domain].keys()):self.sf.debug("Return code not found in list: " + str(addr))continuediff --git a/modules/sfp_spamhaus.py b/modules/sfp_spamhaus.pyindex 0edda803..364f1e3a 100644--- a/modules/sfp_spamhaus.py+++ b/modules/sfp_spamhaus.py@@ -60,7 +60,7 @@ class sfp_spamhaus(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -101,7 +101,7 @@ class sfp_spamhaus(SpiderFootPlugin):text = self.checks[domain] + " (" + qaddr + ")"breakelse:- if str(addr) not in self.checks[domain].keys():+ if str(addr) not in list(self.checks[domain].keys()):self.sf.debug("Return code not found in list: " + str(addr))continuediff --git a/modules/sfp_spider.py b/modules/sfp_spider.pyindex fd2c0095..2831365d 100644--- a/modules/sfp_spider.py+++ b/modules/sfp_spider.py@@ -71,7 +71,7 @@ class sfp_spider(SpiderFootPlugin):self.siteCookies = self.tempStorage()self.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# Fetch data from a URL and obtain all links that should be followed@@ -81,7 +81,7 @@ class sfp_spider(SpiderFootPlugin):# Filter out certain file types (if user chooses to)checkExts = lambda ext: url.lower().split('?')[0].endswith('.' + ext.lower())- if filter(checkExts, self.opts['filterfiles']):+ if list(filter(checkExts, self.opts['filterfiles'])):#self.sf.debug('Ignoring filtered extension: ' + link)return None@@ -169,7 +169,7 @@ class sfp_spider(SpiderFootPlugin):# If we are respecting robots.txt, filter those out tooif linkBase in self.robotsRules and self.opts['robotsonly']:checkRobots = lambda blocked: type(blocked).lower(blocked) in link.lower() or blocked == '*'- if filter(checkRobots, self.robotsRules[linkBase]):+ if list(filter(checkRobots, self.robotsRules[linkBase])):#self.sf.debug("Ignoring page found in robots.txt: " + link)continue@@ -186,8 +186,8 @@ class sfp_spider(SpiderFootPlugin):else:utype = "LINKED_URL_EXTERNAL"- if type(url) != unicode:- url = unicode(url, "utf-8", errors='replace')+ if type(url) != str:+ url = str(url, "utf-8", errors='replace')event = SpiderFootEvent(utype, url, self.__name__, parentEvent)self.notifyListeners(event)return eventdiff --git a/modules/sfp_spyonweb.py b/modules/sfp_spyonweb.pyindex ae0f6c7e..dfeff8e7 100644--- a/modules/sfp_spyonweb.py+++ b/modules/sfp_spyonweb.py@@ -51,7 +51,7 @@ class sfp_spyonweb(SpiderFootPlugin):self.results = self.tempStorage()self.cohostcount = 0- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -196,14 +196,14 @@ class sfp_spyonweb(SpiderFootPlugin):google_adsense = data.get('adsense')if google_adsense:- for r in google_adsense.keys():+ for r in list(google_adsense.keys()):evt = SpiderFootEvent("WEB_ANALYTICS_ID", "Google AdSense: " + r, self.__name__, event)self.notifyListeners(evt)google_analytics = data.get('analytics')if google_analytics:- for r in google_analytics.keys():+ for r in list(google_analytics.keys()):evt = SpiderFootEvent("WEB_ANALYTICS_ID", "Google Analytics: " + r, self.__name__, event)self.notifyListeners(evt)@@ -229,7 +229,7 @@ class sfp_spyonweb(SpiderFootPlugin):self.sf.info("No data found for " + eventData)return None- for r in data.keys():+ for r in list(data.keys()):last_seen = int(datetime.datetime.strptime(data[r], '%Y-%m-%d').strftime('%s')) * 1000if last_seen < agelimit:@@ -253,7 +253,7 @@ class sfp_spyonweb(SpiderFootPlugin):cohostcount = 0- for co in data.keys():+ for co in list(data.keys()):last_seen = int(datetime.datetime.strptime(data[co], '%Y-%m-%d').strftime('%s')) * 1000if last_seen < agelimit:diff --git a/modules/sfp_sslcert.py b/modules/sfp_sslcert.pyindex 269a0372..276c2924 100644--- a/modules/sfp_sslcert.py+++ b/modules/sfp_sslcert.py@@ -46,7 +46,7 @@ class sfp_sslcert(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_ssltools.py b/modules/sfp_ssltools.pyindex eec1c9a3..0b0f1fef 100644--- a/modules/sfp_ssltools.py+++ b/modules/sfp_ssltools.py@@ -12,7 +12,7 @@import jsonimport time-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent@@ -38,7 +38,7 @@ class sfp_ssltools(SpiderFootPlugin):self.__dataSource__ = 'SSL Tools'self.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -64,7 +64,7 @@ class sfp_ssltools(SpiderFootPlugin):headers = { 'Content-Type': 'application/x-www-form-urlencoded' }res = self.sf.fetchUrl('http://www.ssltools.com/api/dns',- postData=urllib.urlencode(params),+ postData=urllib.parse.urlencode(params),headers=headers,timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'])@@ -95,7 +95,7 @@ class sfp_ssltools(SpiderFootPlugin):headers = { 'Content-Type': 'application/x-www-form-urlencoded' }res = self.sf.fetchUrl('http://www.ssltools.com/api/scan',- postData=urllib.urlencode(params),+ postData=urllib.parse.urlencode(params),headers=headers,timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'])diff --git a/modules/sfp_strangeheaders.py b/modules/sfp_strangeheaders.pyindex 99b4083c..a04514f5 100644--- a/modules/sfp_strangeheaders.py+++ b/modules/sfp_strangeheaders.py@@ -37,7 +37,7 @@ class sfp_strangeheaders(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_talosintel.py b/modules/sfp_talosintel.pyindex af4f7c24..89e20c80 100644--- a/modules/sfp_talosintel.py+++ b/modules/sfp_talosintel.py@@ -61,7 +61,7 @@ class sfp_talosintel(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -100,10 +100,10 @@ class sfp_talosintel(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -122,7 +122,7 @@ class sfp_talosintel(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -180,8 +180,8 @@ class sfp_talosintel(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -194,7 +194,7 @@ class sfp_talosintel(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -230,7 +230,7 @@ class sfp_talosintel(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_template.py b/modules/sfp_template.pyindex 0354b595..f905c187 100644--- a/modules/sfp_template.py+++ b/modules/sfp_template.py@@ -39,7 +39,7 @@ class sfp_XXX(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_threatcrowd.py b/modules/sfp_threatcrowd.pyindex 29e8fded..01462cb3 100644--- a/modules/sfp_threatcrowd.py+++ b/modules/sfp_threatcrowd.py@@ -53,7 +53,7 @@ class sfp_threatcrowd(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_threatexpert.py b/modules/sfp_threatexpert.pyindex 5cdf2ab7..e84c4c1f 100644--- a/modules/sfp_threatexpert.py+++ b/modules/sfp_threatexpert.py@@ -58,7 +58,7 @@ class sfp_threatexpert(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -98,10 +98,10 @@ class sfp_threatexpert(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -120,7 +120,7 @@ class sfp_threatexpert(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -178,8 +178,8 @@ class sfp_threatexpert(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -192,7 +192,7 @@ class sfp_threatexpert(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -228,7 +228,7 @@ class sfp_threatexpert(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_threatminer.py b/modules/sfp_threatminer.pyindex ff01abf0..2167988d 100644--- a/modules/sfp_threatminer.py+++ b/modules/sfp_threatminer.py@@ -59,7 +59,7 @@ class sfp_threatminer(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_tldsearch.py b/modules/sfp_tldsearch.pyindex 5906cdec..dbd8e337 100644--- a/modules/sfp_tldsearch.py+++ b/modules/sfp_tldsearch.py@@ -46,7 +46,7 @@ class sfp_tldsearch(SpiderFootPlugin):self.__dataSource__ = "DNS"self.lock = threading.Lock()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -156,8 +156,8 @@ class sfp_tldsearch(SpiderFootPlugin):# Look through all TLDs for the existence of this target keywordfor tld in self.opts['_internettlds']:- if type(tld) != unicode:- tld = unicode(tld.strip(), errors='ignore')+ if type(tld) != str:+ tld = str(tld.strip(), errors='ignore')else:tld = tld.strip()diff --git a/modules/sfp_tool_cmseek.py b/modules/sfp_tool_cmseek.pyindex 7afe7dd3..ebc6a4ad 100644--- a/modules/sfp_tool_cmseek.py+++ b/modules/sfp_tool_cmseek.py@@ -41,7 +41,7 @@ class sfp_tool_cmseek(SpiderFootPlugin):self.errorState = Falseself.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_tool_dnstwist.py b/modules/sfp_tool_dnstwist.pyindex 7d35e14c..76969ca3 100644--- a/modules/sfp_tool_dnstwist.py+++ b/modules/sfp_tool_dnstwist.py@@ -40,7 +40,7 @@ class sfp_tool_dnstwist(SpiderFootPlugin):self.errorState = Falseself.__dataSource__ = "DNS"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_tool_whatweb.py b/modules/sfp_tool_whatweb.pyindex 88571e7c..79bb6f4b 100644--- a/modules/sfp_tool_whatweb.py+++ b/modules/sfp_tool_whatweb.py@@ -43,7 +43,7 @@ class sfp_tool_whatweb(SpiderFootPlugin):self.errorState = Falseself.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]def watchedEvents(self):diff --git a/modules/sfp_torch.py b/modules/sfp_torch.pyindex 242b7abb..227967d2 100644--- a/modules/sfp_torch.py+++ b/modules/sfp_torch.py@@ -40,7 +40,7 @@ class sfp_torch(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_torexits.py b/modules/sfp_torexits.pyindex a8421678..a5d6d09b 100644--- a/modules/sfp_torexits.py+++ b/modules/sfp_torexits.py@@ -63,7 +63,7 @@ class sfp_torexits(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -102,10 +102,10 @@ class sfp_torexits(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -124,7 +124,7 @@ class sfp_torexits(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -182,8 +182,8 @@ class sfp_torexits(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -196,7 +196,7 @@ class sfp_torexits(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -232,7 +232,7 @@ class sfp_torexits(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_torserver.py b/modules/sfp_torserver.pyindex 22c5cfa0..e95cfbd4 100644--- a/modules/sfp_torserver.py+++ b/modules/sfp_torserver.py@@ -62,7 +62,7 @@ class sfp_torserver(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -101,10 +101,10 @@ class sfp_torserver(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -123,7 +123,7 @@ class sfp_torserver(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -181,8 +181,8 @@ class sfp_torserver(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -195,7 +195,7 @@ class sfp_torserver(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -231,7 +231,7 @@ class sfp_torserver(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_totalhash.py b/modules/sfp_totalhash.pyindex ddae6a42..10cfc43b 100644--- a/modules/sfp_totalhash.py+++ b/modules/sfp_totalhash.py@@ -59,7 +59,7 @@ class sfp_totalhash(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -100,10 +100,10 @@ class sfp_totalhash(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -122,7 +122,7 @@ class sfp_totalhash(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -180,8 +180,8 @@ class sfp_totalhash(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -194,7 +194,7 @@ class sfp_totalhash(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -226,7 +226,7 @@ class sfp_totalhash(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_twitter.py b/modules/sfp_twitter.pyindex 2554f920..b9beec51 100644--- a/modules/sfp_twitter.py+++ b/modules/sfp_twitter.py@@ -32,7 +32,7 @@ class sfp_twitter(SpiderFootPlugin):self.__dataSource__ = "Twitter"self.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_uceprotect.py b/modules/sfp_uceprotect.pyindex f18374f5..0daa7d64 100644--- a/modules/sfp_uceprotect.py+++ b/modules/sfp_uceprotect.py@@ -52,7 +52,7 @@ class sfp_uceprotect(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -93,7 +93,7 @@ class sfp_uceprotect(SpiderFootPlugin):text = self.checks[domain] + " (" + qaddr + ")"breakelse:- if str(addr) not in self.checks[domain].keys():+ if str(addr) not in list(self.checks[domain].keys()):self.sf.debug("Return code not found in list: " + str(addr))continuediff --git a/modules/sfp_urlscan.py b/modules/sfp_urlscan.pyindex d5b6ec18..6340cb61 100644--- a/modules/sfp_urlscan.py+++ b/modules/sfp_urlscan.py@@ -11,7 +11,7 @@# -------------------------------------------------------------------------------import json-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_urlscan(SpiderFootPlugin):@@ -32,7 +32,7 @@ class sfp_urlscan(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -51,7 +51,7 @@ class sfp_urlscan(SpiderFootPlugin):'q': 'domain:' + qry.encode('raw_unicode_escape')}- res = self.sf.fetchUrl('https://urlscan.io/api/v1/search/?' + urllib.urlencode(params),+ res = self.sf.fetchUrl('https://urlscan.io/api/v1/search/?' + urllib.parse.urlencode(params),timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'])@@ -131,7 +131,7 @@ class sfp_urlscan(SpiderFootPlugin):if asn:asns.append(asn.replace('AS', ''))- location = ', '.join(filter(None, [page.get('city'), page.get('country')]))+ location = ', '.join([_f for _f in [page.get('city'), page.get('country')] if _f])if location:locations.append(location)diff --git a/modules/sfp_venmo.py b/modules/sfp_venmo.pyindex fff53ae9..8d1c4ace 100644--- a/modules/sfp_venmo.py+++ b/modules/sfp_venmo.py@@ -30,7 +30,7 @@ class sfp_venmo(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_viewdns.py b/modules/sfp_viewdns.pyindex 320fe920..2d5e189f 100644--- a/modules/sfp_viewdns.py+++ b/modules/sfp_viewdns.py@@ -47,7 +47,7 @@ class sfp_viewdns(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_virustotal.py b/modules/sfp_virustotal.pyindex 7658f683..a9d1854d 100644--- a/modules/sfp_virustotal.py+++ b/modules/sfp_virustotal.py@@ -59,7 +59,7 @@ class sfp_virustotal(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_voipbl.py b/modules/sfp_voipbl.pyindex 4e4cb2c4..bdc6e9ab 100644--- a/modules/sfp_voipbl.py+++ b/modules/sfp_voipbl.py@@ -61,7 +61,7 @@ class sfp_voipbl(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -100,10 +100,10 @@ class sfp_voipbl(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -122,7 +122,7 @@ class sfp_voipbl(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -180,8 +180,8 @@ class sfp_voipbl(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -194,7 +194,7 @@ class sfp_voipbl(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -230,7 +230,7 @@ class sfp_voipbl(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_vxvault.py b/modules/sfp_vxvault.pyindex fa6544fe..5abb2a62 100644--- a/modules/sfp_vxvault.py+++ b/modules/sfp_vxvault.py@@ -60,7 +60,7 @@ class sfp_vxvault(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -101,10 +101,10 @@ class sfp_vxvault(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -123,7 +123,7 @@ class sfp_vxvault(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -181,8 +181,8 @@ class sfp_vxvault(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -195,7 +195,7 @@ class sfp_vxvault(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -227,7 +227,7 @@ class sfp_vxvault(SpiderFootPlugin):and not self.opts.get('checkaffiliates', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_watchguard.py b/modules/sfp_watchguard.pyindex 7566beb1..7b9198b9 100644--- a/modules/sfp_watchguard.py+++ b/modules/sfp_watchguard.py@@ -56,7 +56,7 @@ class sfp_watchguard(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -93,10 +93,10 @@ class sfp_watchguard(SpiderFootPlugin):# Look up 'query' type sourcesdef resourceQuery(self, id, target, targetType):self.sf.debug("Querying " + id + " for maliciousness of " + target)- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "query":- url = unicode(malchecks[check]['url'])+ url = str(malchecks[check]['url'])res = self.sf.fetchUrl(url.format(target), timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.error("Unable to fetch " + url.format(target), False)@@ -115,7 +115,7 @@ class sfp_watchguard(SpiderFootPlugin):if targetType == "domain":targetDom = self.sf.hostDomain(target, self.opts['_internettlds'])- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if id == cid and malchecks[check]['type'] == "list":data = dict()@@ -173,8 +173,8 @@ class sfp_watchguard(SpiderFootPlugin):else:# Check for the domain and the hostnametry:- rxDom = unicode(malchecks[check]['regex']).format(targetDom)- rxTgt = unicode(malchecks[check]['regex']).format(target)+ rxDom = str(malchecks[check]['regex']).format(targetDom)+ rxTgt = str(malchecks[check]['regex']).format(target)for line in data['content'].split('\n'):if (targetType == "domain" and re.match(rxDom, line, re.IGNORECASE)) or \re.match(rxTgt, line, re.IGNORECASE):@@ -187,7 +187,7 @@ class sfp_watchguard(SpiderFootPlugin):return Nonedef lookupItem(self, resourceId, itemType, target):- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']if cid == resourceId and itemType in malchecks[check]['checks']:self.sf.debug("Checking maliciousness of " + target + " (" +@@ -223,7 +223,7 @@ class sfp_watchguard(SpiderFootPlugin):if eventName == 'NETBLOCK_MEMBER' and not self.opts.get('checksubnets', False):return None- for check in malchecks.keys():+ for check in list(malchecks.keys()):cid = malchecks[check]['id']# If the module is enabled..if self.opts[cid]:diff --git a/modules/sfp_webanalytics.py b/modules/sfp_webanalytics.pyindex 452a8119..10a19801 100644--- a/modules/sfp_webanalytics.py+++ b/modules/sfp_webanalytics.py@@ -30,7 +30,7 @@ class sfp_webanalytics(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_webframework.py b/modules/sfp_webframework.pyindex 0a4bd74e..a4735f88 100644--- a/modules/sfp_webframework.py+++ b/modules/sfp_webframework.py@@ -50,7 +50,7 @@ class sfp_webframework(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -85,7 +85,7 @@ class sfp_webframework(SpiderFootPlugin):self.sf.debug("Not collecting web content information for external sites.")return None- for regexpGrp in regexps.keys():+ for regexpGrp in list(regexps.keys()):if regexpGrp in self.results[eventSource]:continuediff --git a/modules/sfp_webserver.py b/modules/sfp_webserver.pyindex fd0f31f0..e0a202f9 100644--- a/modules/sfp_webserver.py+++ b/modules/sfp_webserver.py@@ -27,7 +27,7 @@ class sfp_webserver(SpiderFootPlugin):self.results = self.tempStorage()self.__dataSource__ = "Target Website"- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_whatcms.py b/modules/sfp_whatcms.pyindex efd4b513..7505370f 100644--- a/modules/sfp_whatcms.py+++ b/modules/sfp_whatcms.py@@ -11,7 +11,7 @@#-------------------------------------------------------------------------------import json-import urllib+import urllib.request, urllib.parse, urllib.errorimport timefrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent@@ -47,7 +47,7 @@ class sfp_whatcms(SpiderFootPlugin):self.results = self.tempStorage()self.errorState = False- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -66,7 +66,7 @@ class sfp_whatcms(SpiderFootPlugin):'key': self.opts['api_key']}- res = self.sf.fetchUrl('https://whatcms.org/APIEndpoint/Detect?' + urllib.urlencode(params),+ res = self.sf.fetchUrl('https://whatcms.org/APIEndpoint/Detect?' + urllib.parse.urlencode(params),timeout=self.opts['timeout'],useragent=self.opts['_useragent'])@@ -82,7 +82,7 @@ class sfp_whatcms(SpiderFootPlugin):'key': self.opts['api_key']}- res = self.sf.fetchUrl('https://whatcms.org/APIEndpoint/Technology?' + urllib.urlencode(params),+ res = self.sf.fetchUrl('https://whatcms.org/APIEndpoint/Technology?' + urllib.parse.urlencode(params),timeout=self.opts['timeout'],useragent=self.opts['_useragent'])@@ -199,7 +199,7 @@ class sfp_whatcms(SpiderFootPlugin):for result in results:if result.get('name'):- software = ' '.join(filter(None, [result.get('name'), result.get('version')]))+ software = ' '.join([_f for _f in [result.get('name'), result.get('version')] if _f])evt = SpiderFootEvent('WEBSERVER_TECHNOLOGY', software, self.__name__, event)self.notifyListeners(evt)else:diff --git a/modules/sfp_whois.py b/modules/sfp_whois.pyindex 3243534e..f7390ffc 100644--- a/modules/sfp_whois.py+++ b/modules/sfp_whois.py@@ -33,7 +33,7 @@ class sfp_whois(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -102,7 +102,7 @@ class sfp_whois(SpiderFootPlugin):rawevt = SpiderFootEvent(typ, data, self.__name__, event)self.notifyListeners(rawevt)- if whoisdata.has_key('registrar'):+ if 'registrar' in whoisdata:if eventName.startswith("DOMAIN_NAME") and whoisdata['registrar'] is not None:evt = SpiderFootEvent("DOMAIN_REGISTRAR", whoisdata['registrar'],self.__name__, event)diff --git a/modules/sfp_whoisology.py b/modules/sfp_whoisology.pyindex 7920ffee..bb0caef3 100644--- a/modules/sfp_whoisology.py+++ b/modules/sfp_whoisology.py@@ -39,7 +39,7 @@ class sfp_whoisology(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_whoxy.py b/modules/sfp_whoxy.pyindex 9304d220..a2889de6 100644--- a/modules/sfp_whoxy.py+++ b/modules/sfp_whoxy.py@@ -39,7 +39,7 @@ class sfp_whoxy(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_wigle.py b/modules/sfp_wigle.pyindex 17d252e6..b717567d 100644--- a/modules/sfp_wigle.py+++ b/modules/sfp_wigle.py@@ -11,7 +11,7 @@import jsonimport datetime-import urllib+import urllib.request, urllib.parse, urllib.errorfrom sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEventclass sfp_wigle(SpiderFootPlugin):@@ -47,7 +47,7 @@ class sfp_wigle(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -60,7 +60,7 @@ class sfp_wigle(SpiderFootPlugin):def getcoords(self, qry):url = "https://api.wigle.net/api/v2/network/geocode?" + \- urllib.urlencode({'addresscode': qry.encode('utf-8', errors='replace')})+ urllib.parse.urlencode({'addresscode': qry.encode('utf-8', errors='replace')})hdrs = {"Accept": "application/json","Authorization": "Basic " + self.opts['api_key_encoded']diff --git a/modules/sfp_wikileaks.py b/modules/sfp_wikileaks.pyindex 25b3d5f5..1d8baa00 100644--- a/modules/sfp_wikileaks.py+++ b/modules/sfp_wikileaks.py@@ -35,7 +35,7 @@ class sfp_wikileaks(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_wikipediaedits.py b/modules/sfp_wikipediaedits.pyindex a03abea0..53f9c16f 100644--- a/modules/sfp_wikipediaedits.py+++ b/modules/sfp_wikipediaedits.py@@ -46,7 +46,7 @@ class sfp_wikipediaedits(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_xforce.py b/modules/sfp_xforce.pyindex 17a38d91..742fdc27 100644--- a/modules/sfp_xforce.py+++ b/modules/sfp_xforce.py@@ -62,7 +62,7 @@ class sfp_xforce(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_yandexdns.py b/modules/sfp_yandexdns.pyindex 29537dba..8ff382c4 100644--- a/modules/sfp_yandexdns.py+++ b/modules/sfp_yandexdns.py@@ -32,7 +32,7 @@ class sfp_yandexdns(SpiderFootPlugin):self.sf = sfcself.results = self.tempStorage()- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/modules/sfp_zoneh.py b/modules/sfp_zoneh.pyindex 305c72c0..6cc30b26 100644--- a/modules/sfp_zoneh.py+++ b/modules/sfp_zoneh.py@@ -49,7 +49,7 @@ class sfp_zoneh(SpiderFootPlugin):# Clear / reset any other class member variables here# or you risk them persisting between threads.- for opt in userOpts.keys():+ for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]# What events is this module interested in for inputdiff --git a/sfcli.py b/sfcli.pyindex 1f74b67c..dca34784 100755--- a/sfcli.py+++ b/sfcli.py@@ -197,10 +197,10 @@ class SpiderFootCli(cmd.Cmd):# Get the column titlesmaxsize = dict()if type(data[0]) == dict:- cols = data[0].keys()+ cols = list(data[0].keys())else:# for lists, use the index numbers as titles- cols = map(str, range(0, len(data[0])))+ cols = list(map(str, list(range(0, len(data[0])))))# Strip out columns that don't have titlesif titlemap:@@ -221,8 +221,8 @@ class SpiderFootCli(cmd.Cmd):if type(c) == int:v = str(c)if type(c) == str:- v = unicode(c, errors='replace')- if type(c) == unicode:+ v = str(c, errors='replace')+ if type(c) == str:v = celse:# we have a dict key@@ -285,8 +285,8 @@ class SpiderFootCli(cmd.Cmd):if tc == int:v = str(c)if tc == str:- v = unicode(c, errors='replace')- if tc == unicode:+ v = str(c, errors='replace')+ if tc == str:v = celse:# we have a dict key@@ -1061,7 +1061,7 @@ class SpiderFootCli(cmd.Cmd):self.ddprint(str(serverconfig))if not cfg or not val:- ks = self.ownopts.keys()+ ks = list(self.ownopts.keys())ks.sort()output = list()for k in ks:@@ -1134,7 +1134,7 @@ class SpiderFootCli(cmd.Cmd):confdata[optstr] = ','.join(serverconfig[k])if type(serverconfig[k]) == int:confdata[optstr] = str(serverconfig[k])- if type(serverconfig[k]) in [ str, unicode ]:+ if type(serverconfig[k]) in == str:confdata[optstr] = serverconfig[k]self.ddprint(str(confdata))diff --git a/sfdb.py b/sfdb.pyindex 4c2b79ac..64b794d8 100644--- a/sfdb.py+++ b/sfdb.py@@ -300,7 +300,7 @@ class SpiderFootDb:# - regex (search values for a regular expression)# ** at least two criteria must be set **def search(self, criteria, filterFp=False):- if criteria.values().count(None) == 3:+ if list(criteria.values()).count(None) == 3:return Falseqvars = list()@@ -590,7 +590,7 @@ class SpiderFootDb:# Store the default configurationdef configSet(self, optMap=dict()):qry = "REPLACE INTO tbl_config (scope, opt, val) VALUES (?, ?, ?)"- for opt in optMap.keys():+ for opt in list(optMap.keys()):# Module optionif ":" in opt:parts = opt.split(':')@@ -637,7 +637,7 @@ class SpiderFootDb:qry = "REPLACE INTO tbl_scan_config \(scan_instance_id, component, opt, val) VALUES (?, ?, ?, ?)"- for opt in optMap.keys():+ for opt in list(optMap.keys()):# Module optionif ":" in opt:parts = opt.split(':')@@ -684,14 +684,14 @@ class SpiderFootDb:def scanEventStore(self, instanceId, sfEvent, truncateSize=0):storeData = ''- if type(sfEvent.data) is not unicode:+ if type(sfEvent.data) is not str:# If sfEvent.data is a dict or list, convert it to a string first, as# those types do not have a unicode converter.if type(sfEvent.data) is str:- storeData = unicode(sfEvent.data, 'utf-8', errors='replace')+ storeData = str(sfEvent.data, 'utf-8', errors='replace')else:try:- storeData = unicode(str(sfEvent.data), 'utf-8', errors='replace')+ storeData = str(sfEvent.data)except BaseException as e:self.sf.fatal("Unhandled type detected: " + str(type(sfEvent.data)))else:diff --git a/sfwebui.py b/sfwebui.pyindex 95f98afb..f29eae85 100644--- a/sfwebui.py+++ b/sfwebui.py@@ -281,15 +281,15 @@ class SpiderFootWebUi:dbh = SpiderFootDb(self.config)ret['config'] = dbh.scanConfigGet(id)ret['configdesc'] = dict()- for key in ret['config'].keys():+ for key in list(ret['config'].keys()):if ':' not in key:ret['configdesc'][key] = self.config['__globaloptdescs__'][key]else:[modName, modOpt] = key.split(':')- if modName not in self.config['__modules__'].keys():+ if modName not in list(self.config['__modules__'].keys()):continue- if modOpt not in self.config['__modules__'][modName]['optdescs'].keys():+ if modOpt not in list(self.config['__modules__'][modName]['optdescs'].keys()):continueret['configdesc'][key] = self.config['__modules__'][modName]['optdescs'][modOpt]@@ -351,7 +351,7 @@ class SpiderFootWebUi:time.sleep(1)templ = Template(filename='dyn/scaninfo.tmpl', lookup=self.lookup)- return templ.render(id=newId, name=unicode(scanname, 'utf-8', errors='replace'), docroot=self.docroot,+ return templ.render(id=newId, name=str(scanname, 'utf-8', errors='replace'), docroot=self.docroot,status=globalScanStatus.getStatus(newId), pageid="SCANLIST")rerunscan.exposed = True@@ -384,8 +384,8 @@ class SpiderFootWebUi:# Start running a new scannewId = sf.genScanInstanceGUID(scanname)- t = SpiderFootScanner(unicode(scanname, 'utf-8', errors='replace'),- unicode(scantarget, 'utf-8', errors='replace').lower(),+ t = SpiderFootScanner(str(scanname, 'utf-8', errors='replace'),+ str(scantarget, 'utf-8', errors='replace').lower(),targetType, newId, modlist, cfg, modopts)t.start()@@ -436,8 +436,8 @@ class SpiderFootWebUi:templ = Template(filename='dyn/newscan.tmpl', lookup=self.lookup)return templ.render(pageid='NEWSCAN', types=types, docroot=self.docroot,modules=self.config['__modules__'], selectedmods=modlist,- scanname=unicode(scanname, 'utf-8', errors='replace'),- scantarget=unicode(scantarget, 'utf-8', errors='replace'))+ scanname=str(scanname, 'utf-8', errors='replace'),+ scantarget=str(scantarget, 'utf-8', errors='replace'))clonescan.exposed = True@@ -530,7 +530,7 @@ class SpiderFootWebUi:return json.dumps(["SUCCESS", ""])else:templ = Template(filename='dyn/scandelete.tmpl', lookup=self.lookup)- return templ.render(id=id, name=unicode(res[0], 'utf-8', errors='replace'),+ return templ.render(id=id, name=str(res[0], 'utf-8', errors='replace'),names=list(), ids=list(),pageid="SCANLIST", docroot=self.docroot)@@ -543,7 +543,7 @@ class SpiderFootWebUi:for id in ids.split(','):res = dbh.scanInstanceGet(id)- names.append(unicode(res[0], 'utf-8', errors='replace'))+ names.append(str(res[0], 'utf-8', errors='replace'))if res is None:return self.error("Scan ID not found (" + id + ").")@@ -591,7 +591,7 @@ class SpiderFootWebUi:else:useropts = json.loads(allopts)cleanopts = dict()- for opt in useropts.keys():+ for opt in list(useropts.keys()):cleanopts[opt] = self.cleanUserInput([useropts[opt]])[0]currentopts = deepcopy(self.config)@@ -625,7 +625,7 @@ class SpiderFootWebUi:else:useropts = json.loads(allopts)cleanopts = dict()- for opt in useropts.keys():+ for opt in list(useropts.keys()):cleanopts[opt] = self.cleanUserInput([useropts[opt]])[0]currentopts = deepcopy(self.config)@@ -697,7 +697,7 @@ class SpiderFootWebUi:# For the CLI to fetch a list of modules.def modules(self):- modinfo = self.config['__modules__'].keys()+ modinfo = list(self.config['__modules__'].keys())modinfo.sort()ret = list()for m in modinfo:@@ -840,7 +840,7 @@ class SpiderFootWebUi:if scaninfo is None:return self.error("Invalid scan ID specified.")- scanname = unicode(scaninfo[0], 'utf-8', errors='replace')+ scanname = str(scaninfo[0], 'utf-8', errors='replace')if globalScanStatus.getStatus(id) == "FINISHED" or scaninfo[5] == "FINISHED":error.append("Scan '" + scanname + "' is in a finished state. <a href='/scandelete?id=" + \@@ -935,7 +935,7 @@ class SpiderFootWebUi:for row in data:generated = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(row[0] / 1000))retdata.append([generated, row[1],- cgi.escape(unicode(row[2], errors='replace'))])+ cgi.escape(str(row[2], errors='replace'))])return json.dumps(retdata)scanerrors.exposed = True