SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
flake8: resolve flake8 violations
Brendan Coles59107e5b9ac2
diff --git a/modules/__init__.py b/modules/__init__.pyindex 8b137891..e69de29b 100644--- a/modules/__init__.py+++ b/modules/__init__.py@@ -1 +0,0 @@-diff --git a/modules/sfp_countryname.py b/modules/sfp_countryname.pyindex f5275bd4..d161c383 100644--- a/modules/sfp_countryname.py+++ b/modules/sfp_countryname.py@@ -321,10 +321,10 @@ class sfp_countryname(SpiderFootPlugin):"UK": "United Kingdom"}return abbvCountryCodes-+# Getter method for dictionary of codes not associated with any countrydef getNonCountryCodesDict(self):-+# List of TLD not associated with any countrynonCountryCodes = ["COM", "NET", "ORG", "GOV", "MIL"]@@ -334,11 +334,11 @@ class sfp_countryname(SpiderFootPlugin):nonCountryCodesDict = dict()# Set default country name for all keys- for nonCountryCode in nonCountryCodes:+ for nonCountryCode in nonCountryCodes:nonCountryCodesDict[nonCountryCode] = defaultCountryCode-+return nonCountryCodesDict-+# Detect name of country from phone numberdef detectCountryFromPhone(self, srcPhoneNumber):diff --git a/modules/sfp_creditcard.py b/modules/sfp_creditcard.pyindex 75b6dfc7..f431703d 100644--- a/modules/sfp_creditcard.py+++ b/modules/sfp_creditcard.py@@ -80,14 +80,14 @@ class sfp_creditcard(SpiderFootPlugin):myres = list()for creditCard in creditCards:evttype = "CREDIT_CARD_NUMBER"-+self.sf.info("Found credit card number : " + creditCard)if creditCard in myres:self.sf.debug("Already found from this source")continuemyres.append(creditCard)-+evt = SpiderFootEvent(evttype, creditCard, self.__name__, event)if event.moduleDataSource:evt.moduleDataSource = event.moduleDataSourcediff --git a/modules/sfp_emailcrawlr.py b/modules/sfp_emailcrawlr.pyindex e0db2d5a..e0be68e3 100644--- a/modules/sfp_emailcrawlr.py+++ b/modules/sfp_emailcrawlr.py@@ -90,7 +90,7 @@ class sfp_emailcrawlr(SpiderFootPlugin):'Accept': "application/json",'x-api-key': self.opts['api_key']}-+res = self.sf.fetchUrl("https://api.emailcrawlr.com/v2/domain?%s" % urllib.parse.urlencode(params),headers=headers,diff --git a/modules/sfp_fraudguard.py b/modules/sfp_fraudguard.pyindex 924b3a92..a0b97240 100644--- a/modules/sfp_fraudguard.py+++ b/modules/sfp_fraudguard.py@@ -202,5 +202,5 @@ class sfp_fraudguard(SpiderFootPlugin):dat = rec['threat'] + " (risk level: " + rec['risk_level'] + ") [" + eventData + "]"e = SpiderFootEvent("MALICIOUS_" + rtype, dat, self.__name__, pevent)self.notifyListeners(e)-+# End of sfp_fraudguard classdiff --git a/modules/sfp_fringeproject.py b/modules/sfp_fringeproject.pyindex 6735187d..2f00e60b 100644--- a/modules/sfp_fringeproject.py+++ b/modules/sfp_fringeproject.py@@ -36,7 +36,7 @@ class sfp_fringeproject(SpiderFootPlugin):'logo': "https://fringeproject.com/favicon.png",'description': "Discover the Right Data for Your Security Assessment.\n""FringeProject allows you to scan and search through various source of information to discover assets and vulnerabilities.\n"- "We parse your data and add it to our runner. "+ "We parse your data and add it to our runner. ""It does active and passive scanning to find new assets on the Internet.",}}diff --git a/modules/sfp_googlemaps.py b/modules/sfp_googlemaps.pyindex fa68e6a7..a1589814 100644--- a/modules/sfp_googlemaps.py+++ b/modules/sfp_googlemaps.py@@ -101,14 +101,14 @@ class sfp_googlemaps(SpiderFootPlugin):self.results[eventData] = Trueres = self.sf.fetchUrl("https://maps.googleapis.com/maps/api/geocode/json?address=" + \- eventData + "&key=" + self.opts['api_key'],- timeout=self.opts['_fetchtimeout'],+ eventData + "&key=" + self.opts['api_key'],+ timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'])if res['content'] is None:self.sf.info("No location info found for " + eventData)return None- evt = SpiderFootEvent("RAW_RIR_DATA", res['content'],+ evt = SpiderFootEvent("RAW_RIR_DATA", res['content'],self.__name__, event)self.notifyListeners(evt)@@ -124,7 +124,7 @@ class sfp_googlemaps(SpiderFootPlugin):self.notifyListeners(evt)if 'formatted_address' in data:- evt = SpiderFootEvent("PHYSICAL_ADDRESS", data['formatted_address'],+ evt = SpiderFootEvent("PHYSICAL_ADDRESS", data['formatted_address'],self.__name__, event)self.notifyListeners(evt)except Exception as e:diff --git a/modules/sfp_googleobjectstorage.py b/modules/sfp_googleobjectstorage.pyindex 6e00f831..0210c800 100644--- a/modules/sfp_googleobjectstorage.py+++ b/modules/sfp_googleobjectstorage.py@@ -177,7 +177,7 @@ class sfp_googleobjectstorage(SpiderFootPlugin):self.notifyListeners(evt)if bucket[2] != "0":bucketname = bucket[1].replace("//", "")- evt = SpiderFootEvent("CLOUD_STORAGE_BUCKET_OPEN", bucketname + ": " + bucket[2] + " files found.",+ evt = SpiderFootEvent("CLOUD_STORAGE_BUCKET_OPEN", bucketname + ": " + bucket[2] + " files found.",self.__name__, evt)self.notifyListeners(evt)diff --git a/modules/sfp_googlesafebrowsing.py b/modules/sfp_googlesafebrowsing.pyindex df7567e3..fec3ae04 100644--- a/modules/sfp_googlesafebrowsing.py+++ b/modules/sfp_googlesafebrowsing.py@@ -97,7 +97,7 @@ class sfp_googlesafebrowsing(SpiderFootPlugin):f":find?key={self.opts['api_key']}")payload = {- "client": {"clientId": "SpiderFoot", "clientVersion": "3.2",},+ "client": {"clientId": "SpiderFoot", "clientVersion": "3.2"},"threatInfo": {"threatTypes": ["THREAT_TYPE_UNSPECIFIED",diff --git a/modules/sfp_grep_app.py b/modules/sfp_grep_app.pyindex 660c3ef5..6757150e 100644--- a/modules/sfp_grep_app.py+++ b/modules/sfp_grep_app.py@@ -32,7 +32,7 @@ class sfp_grep_app(SpiderFootPlugin):'references': [],'favIcon': "https://grep.app/favicon-16x16.png",'logo': "https://grep.app/apple-touch-icon.png",- 'description': "grep.app searches code from over a half million public repositories on GitHub.\n"+ 'description': "grep.app searches code from over a half million public repositories on GitHub.\n""It searches for the exact string you enter, including any punctuation or other characters.\n""You can also search by regular expression, using the RE2 syntax.",}@@ -65,7 +65,7 @@ class sfp_grep_app(SpiderFootPlugin):return ["DOMAIN_NAME"]def producedEvents(self):- return ["EMAILADDR", "EMAILADDR_GENERIC", "DOMAIN_NAME",+ return ["EMAILADDR", "EMAILADDR_GENERIC", "DOMAIN_NAME","INTERNET_NAME", "RAW_RIR_DATA","INTERNET_NAME_UNRESOLVED", "LINKED_URL_INTERNAL"]diff --git a/modules/sfp_hackertarget.py b/modules/sfp_hackertarget.pyindex 961d3c21..3d2995d2 100644--- a/modules/sfp_hackertarget.py+++ b/modules/sfp_hackertarget.py@@ -37,7 +37,7 @@ class sfp_hackertarget(SpiderFootPlugin):],'favIcon': "https://www.google.com/s2/favicons?domain=https://hackertarget.com/",'logo': "https://hackertarget.com/wp-content/uploads/2018/03/online-security.png",- 'description': "Simplify the security assessment process with hosted vulnerability scanners. "+ 'description': "Simplify the security assessment process with hosted vulnerability scanners. ""From attack surface discovery to vulnerability identification, ""actionable network intelligence for IT & security operations. ""Proactively hunt for security weakness. "diff --git a/modules/sfp_hashes.py b/modules/sfp_hashes.pyindex 2817e9da..14c7d698 100644--- a/modules/sfp_hashes.py+++ b/modules/sfp_hashes.py@@ -42,7 +42,7 @@ class sfp_hashes(SpiderFootPlugin):# What events is this module interested in for inputdef watchedEvents(self):return ["TARGET_WEB_CONTENT", "BASE64_DATA",- "LEAKSITE_CONTENT", "RAW_DNS_RECORDS",+ "LEAKSITE_CONTENT", "RAW_DNS_RECORDS","RAW_FILE_META_DATA"]# What events this module producesdiff --git a/modules/sfp_hybrid_analysis.py b/modules/sfp_hybrid_analysis.pyindex 4e7f9ca2..153a1027 100644--- a/modules/sfp_hybrid_analysis.py+++ b/modules/sfp_hybrid_analysis.py@@ -139,7 +139,7 @@ class sfp_hybrid_analysis(SpiderFootPlugin):Query hashhttps://www.hybrid-analysis.com/docs/api/v2"""-+params = {"hash": qry.encode('raw_unicode_escape').decode("ascii", errors='replace')}@@ -247,7 +247,7 @@ class sfp_hybrid_analysis(SpiderFootPlugin):urls = []domains = []-+for hash in hashes:results = self.queryHash(hash)@@ -276,7 +276,7 @@ class sfp_hybrid_analysis(SpiderFootPlugin):for url in set(urls):host = self.sf.urlFQDN(url.lower())-+if not self.getTarget().matches(host, includeChildren=True, includeParents=True):continuediff --git a/modules/sfp_iban.py b/modules/sfp_iban.pyindex 3cd37297..d33e1598 100644--- a/modules/sfp_iban.py+++ b/modules/sfp_iban.py@@ -81,14 +81,14 @@ class sfp_iban(SpiderFootPlugin):myres = list()for ibanNumber in ibanNumbers:evttype = "IBAN_NUMBER"-+self.sf.info("Found IBAN number : " + ibanNumber)if ibanNumber in myres:self.sf.debug("Already found from this source")continuemyres.append(ibanNumber)-+evt = SpiderFootEvent(evttype, ibanNumber, self.__name__, event)if event.moduleDataSource:evt.moduleDataSource = event.moduleDataSourcediff --git a/modules/sfp_intelx.py b/modules/sfp_intelx.pyindex afc0764a..94057ac0 100644--- a/modules/sfp_intelx.py+++ b/modules/sfp_intelx.py@@ -102,7 +102,7 @@ class sfp_intelx(SpiderFootPlugin):# What events this module producesdef producedEvents(self):- return ["LEAKSITE_URL", "DARKNET_MENTION_URL",+ return ["LEAKSITE_URL", "DARKNET_MENTION_URL","INTERNET_NAME", "DOMAIN_NAME","EMAILADDR", "EMAILADDR_GENERIC"]@@ -125,10 +125,10 @@ class sfp_intelx(SpiderFootPlugin):"sort": 4,"media": 0,"terminate": []- }+ }- url = 'https://' + self.opts['base_url'] + '/' + qtype + '/search'- res = self.sf.fetchUrl(url, postData=json.dumps(payload),+ url = 'https://' + self.opts['base_url'] + '/' + qtype + '/search'+ res = self.sf.fetchUrl(url, postData=json.dumps(payload),headers=headers, timeout=self.opts['_fetchtimeout'])if res['content'] is None:@@ -173,7 +173,7 @@ class sfp_intelx(SpiderFootPlugin):breaktime.sleep(1)-+return retdata# Handle events sent to this module@@ -234,7 +234,7 @@ class sfp_intelx(SpiderFootPlugin):except BaseException as e:self.sf.error("Error processing content from IntelX: " + str(e), False)continue-+# Notify other modules of what you've founde = SpiderFootEvent(evt, val, self.__name__, event)self.notifyListeners(e)@@ -277,7 +277,7 @@ class sfp_intelx(SpiderFootPlugin):if evt == "INTERNET_NAME" and self.sf.isDomain(val, self.opts['_internettlds']):e = SpiderFootEvent("DOMAIN_NAME", val, self.__name__, event)self.notifyListeners(e)-+diff --git a/modules/sfp_ipstack.py b/modules/sfp_ipstack.pyindex e1079dc2..f85a2b14 100644--- a/modules/sfp_ipstack.py+++ b/modules/sfp_ipstack.py@@ -93,10 +93,10 @@ class sfp_ipstack(SpiderFootPlugin):if eventData in self.results:self.sf.debug(f"Skipping {eventData}, already checked.")return None- else:- self.results[eventData] = True- res = self.sf.fetchUrl("http://api.ipstack.com/" + eventData + "?access_key=" + self.opts['api_key'],+ self.results[eventData] = True++ res = self.sf.fetchUrl("http://api.ipstack.com/" + eventData + "?access_key=" + self.opts['api_key'],timeout=self.opts['_fetchtimeout'], useragent=self.opts['_useragent'])if res['content'] is None:self.sf.info("No GeoIP info found for " + eventData)@@ -111,11 +111,10 @@ class sfp_ipstack(SpiderFootPlugin):self.sf.debug(f"Error processing JSON response: {e}")return None- if hostip.get('country_name', None) != None:- self.sf.info("Found GeoIP for " + eventData + ": " + hostip['country_name'])- countrycity = hostip['country_name']-- evt = SpiderFootEvent("GEOINFO", countrycity, self.__name__, event)+ geoinfo = hostip.get('country_name')+ if geoinfo:+ self.sf.info(f"Found GeoIP for {eventData}: {geoinfo}")+ evt = SpiderFootEvent("GEOINFO", geoinfo, self.__name__, event)self.notifyListeners(evt)return Nonediff --git a/modules/sfp_jsonwhoiscom.py b/modules/sfp_jsonwhoiscom.pyindex 18cac5f5..22932413 100644--- a/modules/sfp_jsonwhoiscom.py+++ b/modules/sfp_jsonwhoiscom.py@@ -89,7 +89,7 @@ class sfp_jsonwhoiscom(SpiderFootPlugin):"Accept": "application/json","Authorization": "Token token=" + self.opts["api_key"]}-+res = self.sf.fetchUrl("https://jsonwhois.com/api/v1/whois?%s" % urllib.parse.urlencode(params),headers=headers,diff --git a/modules/sfp_keybase.py b/modules/sfp_keybase.pyindex 2677be95..ac45be59 100644--- a/modules/sfp_keybase.py+++ b/modules/sfp_keybase.py@@ -2,7 +2,7 @@# -------------------------------------------------------------------------------# Name: sfp_keybase# Purpose: Spiderfoot plugin to query KeyBase API-# to gather additional information about username+# to gather additional information about username## Author: Krishnasis Mandal <[email protected]>#@@ -64,7 +64,7 @@ class sfp_keybase(SpiderFootPlugin):def producedEvents(self):return ["RAW_RIR_DATA", "SOCIAL_MEDIA", "USERNAME",- "HUMAN_NAME", "GEOINFO", "BITCOIN_ADDRESS",+ "HUMAN_NAME", "GEOINFO", "BITCOIN_ADDRESS","PGP_KEY"]@@ -85,11 +85,11 @@ class sfp_keybase(SpiderFootPlugin):useragent=self.opts['_useragent'])- # In this case, it will always be 200 if keybase is queried+ # In this case, it will always be 200 if keybase is queried# The actual response codes are stored in status tag of the responseif not res['code'] == '200':return None-+content = json.loads(res['content'])status = content.get('status')@@ -99,7 +99,7 @@ class sfp_keybase(SpiderFootPlugin):code = status.get('code')if code is None:return None-+try:if not int(code) == 0:return None@@ -129,7 +129,7 @@ class sfp_keybase(SpiderFootPlugin):userName = eventData- # Extract username if a Keybase link is received+ # Extract username if a Keybase link is receivedif eventName == "LINKED_URL_EXTERNAL":linkRegex = r"^https?://keybase.io\/[A-Za-z0-9\-_\.]+"links = re.findall(linkRegex, eventData)@@ -143,7 +143,7 @@ class sfp_keybase(SpiderFootPlugin):if userName in self.results:self.sf.debug(f"Skipping {userName}, already checked.")return None-+self.results[userName] = Truecontent = self.queryUsername(userName)@@ -151,14 +151,14 @@ class sfp_keybase(SpiderFootPlugin):if content is None:self.sf.debug("No data found for username")return None-+evt = SpiderFootEvent("RAW_RIR_DATA", str(content), self.__name__, event)- self.notifyListeners(evt)+ self.notifyListeners(evt)if eventName == "LINKED_URL_EXTERNAL":evt = SpiderFootEvent("USERNAME", userName, self.__name__, event)- self.notifyListeners(evt)-+ self.notifyListeners(evt)+# Contains all data about the target usernametry:them = content.get('them')[0]@@ -182,20 +182,20 @@ class sfp_keybase(SpiderFootPlugin):if not userName == responseUserName:self.sf.error("Username does not match received response, skipping", False)return None-+if profile:# Get and report full name of userfullName = profile.get('full_name')if fullName:evt = SpiderFootEvent("HUMAN_NAME", fullName, self.__name__, event)self.notifyListeners(evt)-+# Get and report location of userlocation = profile.get('location')if location:evt = SpiderFootEvent("GEOINFO", location, self.__name__, event)self.notifyListeners(evt)-+# Extract social media informationproofsSummary = them.get('proofs_summary')@@ -212,8 +212,8 @@ class sfp_keybase(SpiderFootPlugin):evt = SpiderFootEvent("SOCIAL_MEDIA", socialMedia, self.__name__, event)self.notifyListeners(evt)-- # Get cryptocurrency addresses++ # Get cryptocurrency addressescryptoAddresses = them.get('cryptocurrency_addresses')# Extract and report bitcoin addresses if any@@ -235,7 +235,7 @@ class sfp_keybase(SpiderFootPlugin):pgpRegex = r"-----BEGIN\s*PGP\s*(?:PUBLIC?)\s*KEY\s*BLOCK-----(.*?)-----END\s*PGP\s*(?:PUBLIC?)\s*KEY\s*BLOCK-----"pgpKeys = re.findall(pgpRegex, str(content))-+for pgpKey in pgpKeys:if len(pgpKey) < 300:diff --git a/modules/sfp_mnemonic.py b/modules/sfp_mnemonic.pyindex dee2e7b8..0c965008 100644--- a/modules/sfp_mnemonic.py+++ b/modules/sfp_mnemonic.py@@ -18,7 +18,7 @@ from sflib import SpiderFootPlugin, SpiderFootEventclass sfp_mnemonic(SpiderFootPlugin):"""Mnemonic PassiveDNS:Footprint,Investigate,Passive:Passive DNS::Obtain Passive DNS information from PassiveDNS.mnemonic.no."""-+meta = {'name': "Mnemonic PassiveDNS",'summary': "Obtain Passive DNS information from PassiveDNS.mnemonic.no.",diff --git a/modules/sfp_names.py b/modules/sfp_names.pyindex 3d97cba0..947a2a7d 100644--- a/modules/sfp_names.py+++ b/modules/sfp_names.py@@ -103,7 +103,7 @@ class sfp_names(SpiderFootPlugin):self.notifyListeners(evt)return None- # For RAW_RIR_DATA, there are only specific modules we+ # For RAW_RIR_DATA, there are only specific modules we# expect to see RELEVANT names within.if eventName == "RAW_RIR_DATA":if srcModuleName not in ["sfp_arin", "sfp_builtwith", "sfp_clearbit",diff --git a/modules/sfp_open_passive_dns_database.py b/modules/sfp_open_passive_dns_database.pyindex cb95621b..449a63b8 100644--- a/modules/sfp_open_passive_dns_database.py+++ b/modules/sfp_open_passive_dns_database.py@@ -217,7 +217,7 @@ class sfp_open_passive_dns_database(SpiderFootPlugin):if self.opts['verify'] and not self.sf.validateIP(query, answer):self.sf.debug("Host " + query + " no longer resolves to " + answer)continue-+evt = SpiderFootEvent("IPV6_ADDRESS", answer, self.__name__, event)self.notifyListeners(evt)diff --git a/modules/sfp_phishstats.py b/modules/sfp_phishstats.pyindex 3ea27841..23ad41ca 100644--- a/modules/sfp_phishstats.py+++ b/modules/sfp_phishstats.py@@ -2,7 +2,7 @@# -------------------------------------------------------------------------------# Name: sfp_phishstats# Purpose: Spiderfoot plugin to search PhishStats API-# to determine if an IP is malicious+# to determine if an IP is malicious## Author: Krishnasis Mandal <[email protected]>#@@ -55,7 +55,7 @@ class sfp_phishstats(SpiderFootPlugin):}results = None- errorState = False+ errorState = Falsedef setup(self, sfc, userOpts=dict()):self.sf = sfc@@ -63,7 +63,7 @@ class sfp_phishstats(SpiderFootPlugin):for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]-+# What events is this module interested in for input# For a list of all events, check sfdb.py.def watchedEvents(self):@@ -111,14 +111,13 @@ class sfp_phishstats(SpiderFootPlugin):except:self.sf.error("Ill formatted data received as JSON response", False)return None-+# Handle events sent to this moduledef handleEvent(self, event):-eventName = event.eventTypesrcModuleName = event.moduleeventData = event.data-+if self.errorState:return None@@ -128,29 +127,29 @@ class sfp_phishstats(SpiderFootPlugin):if eventData in self.results:self.sf.debug(f"Skipping {eventData}, already checked.")return None- else:- self.results[eventData] = True-++ self.results[eventData] = True+if eventName == 'NETBLOCK_OWNER':if not self.opts['netblocklookup']:return Noneif IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return None-+if eventName == 'NETBLOCK_MEMBER':if not self.opts['subnetlookup']:return Noneif IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return None-+qrylist = list()if eventName.startswith("NETBLOCK_"):for ipaddr in IPNetwork(eventData):@@ -161,23 +160,23 @@ class sfp_phishstats(SpiderFootPlugin):if eventName == "AFFILIATE_IPADDR" and not self.opts['checkaffiliates']:return Noneqrylist.append(eventData)-+for addr in qrylist:if self.checkForStop():return None-+data = self.queryIPAddress(addr)if data is None:break-+try:maliciousIP = data[0].get('ip')except:# If ArrayIndex is out of bounds then data doesn't existcontinue-+if maliciousIP is None:continue@@ -197,7 +196,7 @@ class sfp_phishstats(SpiderFootPlugin):evt = SpiderFootEvent("RAW_RIR_DATA", str(data), self.__name__, event)self.notifyListeners(evt)- maliciousIPDesc = "Phishstats [" + str(maliciousIP) + "]\n"+ maliciousIPDesc = f"Phishstats [{maliciousIP}]\n"maliciousIPDescHash = self.sf.hashstring(maliciousIPDesc)if maliciousIPDescHash in self.results:@@ -210,7 +209,7 @@ class sfp_phishstats(SpiderFootPlugin):evt = SpiderFootEvent("MALICIOUS_AFFILIATE_IPADDR", maliciousIPDesc, self.__name__, event)else:evt = SpiderFootEvent("MALICIOUS_IPADDR", maliciousIPDesc, self.__name__, event)-+self.notifyListeners(evt)return Nonediff --git a/modules/sfp_quad9.py b/modules/sfp_quad9.pyindex 099b5467..f30e7832 100644--- a/modules/sfp_quad9.py+++ b/modules/sfp_quad9.py@@ -41,7 +41,7 @@ class sfp_quad9(SpiderFootPlugin):"Quad9 is an effective and easy way to add an additional layer of security to your infrastructure for free.",}}-+# Default optionsopts = {}diff --git a/modules/sfp_shodan.py b/modules/sfp_shodan.pyindex 2085a0c1..9bcfc5d7 100644--- a/modules/sfp_shodan.py+++ b/modules/sfp_shodan.py@@ -167,7 +167,7 @@ class sfp_shodan(SpiderFootPlugin):hosts = self.searchHosts(eventData)if hosts is None:return None-+evt = SpiderFootEvent("RAW_RIR_DATA", str(hosts), self.__name__, event)self.notifyListeners(evt)diff --git a/modules/sfp_snov.py b/modules/sfp_snov.pyindex 67fb79fa..04631431 100644--- a/modules/sfp_snov.py+++ b/modules/sfp_snov.py@@ -1,7 +1,7 @@# -*- coding: utf-8 -*-# -------------------------------------------------------------------------------# Name: sfp_snov-# Purpose: Spiderfoot plugin to search Snov.IO API for emails+# Purpose: Spiderfoot plugin to search Snov.IO API for emails# associated to target domain## Author: Krishnasis Mandal <[email protected]>@@ -56,7 +56,7 @@ class sfp_snov(SpiderFootPlugin):}results = None- errorState = False+ errorState = False# More than 100 per response is not supported by Snov APIlimit = 100@@ -67,7 +67,7 @@ class sfp_snov(SpiderFootPlugin):for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]-+# What events is this module interested in for input# For a list of all events, check sfdb.py.@@ -77,7 +77,7 @@ class sfp_snov(SpiderFootPlugin):# What events this module producesdef producedEvents(self):return ["EMAILADDR", "EMAILADDR_GENERIC"]-+# Get Authentication token from Snov.IO APIdef queryAccessToken(self):params = {@@ -89,7 +89,7 @@ class sfp_snov(SpiderFootPlugin):headers = {'Accept': "application/json",}-+res = self.sf.fetchUrl('https://api.snov.io/v1/oauth/access_token?' + urllib.parse.urlencode(params),headers=headers,@@ -99,23 +99,23 @@ class sfp_snov(SpiderFootPlugin):if not res['code'] == '200':self.sf.error("No access token received from snov.io for the provided Client ID and/or Client Secret", False)- self.errorState = True+ self.errorState = Truereturn Nonetry:# Extract access token from responsecontent = res.get('content')accessToken = json.loads(content).get('access_token')-+if accessToken is None:self.sf.error("No access token received from snov.io for the provided Client ID and/or Client Secret", False)return Nonereturn str(accessToken)- except Exception:+ except Exception:self.sf.error("No access token received from snov.io for the provided Client ID and/or Client Secret", False)self.errorState = Truereturn None-+# Fetch email addresses related to target domaindef queryDomainName(self, qry, accessToken, currentOffset):params = {@@ -148,7 +148,7 @@ class sfp_snov(SpiderFootPlugin):eventName = event.eventTypesrcModuleName = event.moduleeventData = event.data-+if self.errorState:return None@@ -192,12 +192,12 @@ class sfp_snov(SpiderFootPlugin):except:self.sf.debug("No email address found for target domain")break-+evt = SpiderFootEvent("RAW_RIR_DATA", str(data), self.__name__, event)self.notifyListeners(evt)records = data.get('emails')-+if records:for record in records:if record:@@ -217,7 +217,7 @@ class sfp_snov(SpiderFootPlugin):evt = SpiderFootEvent(evttype, email, self.__name__, event)self.notifyListeners(evt)- # Determine whether the next offset can have data or not+ # Determine whether the next offset can have data or notif len(records) < self.limit:nextPageHasData = FalsecurrentOffset += self.limitdiff --git a/modules/sfp_sorbs.py b/modules/sfp_sorbs.pyindex 0e25388b..ccdc1cb3 100644--- a/modules/sfp_sorbs.py+++ b/modules/sfp_sorbs.py@@ -166,9 +166,9 @@ class sfp_sorbs(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return Noneif eventName == 'NETBLOCK_MEMBER':diff --git a/modules/sfp_spamcop.py b/modules/sfp_spamcop.pyindex dc95b454..2729cdd0 100644--- a/modules/sfp_spamcop.py+++ b/modules/sfp_spamcop.py@@ -157,9 +157,9 @@ class sfp_spamcop(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return Noneif eventName == 'NETBLOCK_MEMBER':@@ -167,9 +167,9 @@ class sfp_spamcop(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return Noneif eventName.startswith("NETBLOCK_"):diff --git a/modules/sfp_spamhaus.py b/modules/sfp_spamhaus.pyindex 3a94befd..e06efdb1 100644--- a/modules/sfp_spamhaus.py+++ b/modules/sfp_spamhaus.py@@ -169,9 +169,9 @@ class sfp_spamhaus(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return Noneif eventName == 'NETBLOCK_MEMBER':@@ -179,9 +179,9 @@ class sfp_spamhaus(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return Noneif eventName.startswith("NETBLOCK_"):diff --git a/modules/sfp_spur.py b/modules/sfp_spur.pyindex 539fa26a..066d78f9 100644--- a/modules/sfp_spur.py+++ b/modules/sfp_spur.py@@ -1,7 +1,7 @@# -*- coding: utf-8 -*-# -------------------------------------------------------------------------------# Name: sfp_spur-# Purpose: Spiderfoot plugin to search spur.us API for any+# Purpose: Spiderfoot plugin to search spur.us API for any# malicious activity by the target## Author: Krishnasis Mandal <[email protected]>@@ -66,7 +66,7 @@ class sfp_spur(SpiderFootPlugin):}results = None- errorState = False+ errorState = Falsedef setup(self, sfc, userOpts=dict()):self.sf = sfc@@ -95,7 +95,7 @@ class sfp_spur(SpiderFootPlugin):"COMPANY_NAME","MALICIOUS_AFFILIATE_IPADDR"]-+# Check whether the IP Address is malicious using spur.us API# https://spur.us/app/docsdef queryIPAddress(self, ipAddr):@@ -118,7 +118,7 @@ class sfp_spur(SpiderFootPlugin):self.sf.error("Invalid credentials. Please check API Token", False)self.errorState = Truereturn None-+if code == '404':self.sf.debug("IP Address not found.")return None@@ -126,17 +126,16 @@ class sfp_spur(SpiderFootPlugin):if not code == '200':self.sf.error("Unable to fetch data from spur.us", False)return None-+content = res.get('content')return contentdef handleEvent(self, event):-eventName = event.eventTypesrcModuleName = event.moduleeventData = event.data-+if self.errorState:return None@@ -161,21 +160,21 @@ class sfp_spur(SpiderFootPlugin):return Noneif IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return None-+if eventName == 'NETBLOCK_MEMBER':if not self.opts['subnetlookup']:return Noneif IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return None-+qrylist = list()if eventName.startswith("NETBLOCK_"):for ipaddr in IPNetwork(eventData):@@ -186,19 +185,19 @@ class sfp_spur(SpiderFootPlugin):if eventName == "AFFILIATE_IPADDR" and not self.opts['checkaffiliates']:return Noneqrylist.append(eventData)-+for addr in qrylist:if self.checkForStop():return None-+content = self.queryIPAddress(addr)if content is None:continue-+data = json.loads(content)-+# For netblocks, create the event for the IP address to link to laterif eventName.startswith("NETBLOCK_"):ipEvt = SpiderFootEvent("IP_ADDRESS", addr, self.__name__, event)@@ -219,13 +218,13 @@ class sfp_spur(SpiderFootPlugin):geoInfo = ""if city:geoInfo += city + ", "-+if state:geoInfo += state + ", "-+if country:geoInfo += country-+if eventName.startswith("NETBLOCK_"):evt = SpiderFootEvent("GEOINFO", geoInfo, self.__name__, ipEvt)self.notifyListeners(evt)@@ -235,11 +234,11 @@ class sfp_spur(SpiderFootPlugin):else:evt = SpiderFootEvent("GEOINFO", geoInfo, self.__name__, event)self.notifyListeners(evt)-+asData = data.get('as')if asData:- orgName = asData.get('organization')+ orgName = asData.get('organization')if orgName:if eventName.startswith("NETBLOCK_"):@@ -251,9 +250,9 @@ class sfp_spur(SpiderFootPlugin):else:evt = SpiderFootEvent("COMPANY_NAME", orgName, self.__name__, event)self.notifyListeners(evt)-+vpnOperators = data.get('vpnOperators')-+vpnOperatorsExists = vpnOperators.get('exists')if vpnOperatorsExists:@@ -279,7 +278,7 @@ class sfp_spur(SpiderFootPlugin):else:evt = SpiderFootEvent("MALICIOUS_IPADDR", maliciousIPDesc, self.__name__, event)self.notifyListeners(evt)-+return None# End of sfp_spur classdiff --git a/modules/sfp_spyse.py b/modules/sfp_spyse.pyindex 9bb5c790..b54b2c17 100644--- a/modules/sfp_spyse.py+++ b/modules/sfp_spyse.py@@ -89,7 +89,7 @@ class sfp_spyse(SpiderFootPlugin):# What events this module producesdef producedEvents(self):return ["INTERNET_NAME", "INTERNET_NAME_UNRESOLVED", "DOMAIN_NAME",- "IP_ADDRESS", "IPV6_ADDRESS", "CO_HOSTED_SITE",+ "IP_ADDRESS", "IPV6_ADDRESS", "CO_HOSTED_SITE","RAW_RIR_DATA", "TCP_PORT_OPEN", "OPERATING_SYSTEM","WEBSERVER_BANNER", "WEBSERVER_HTTPHEADERS"]@@ -98,14 +98,14 @@ class sfp_spyse(SpiderFootPlugin):def querySubdomains(self, qry, currentOffset):params = {'domain': qry.encode('raw_unicode_escape').decode("ascii", errors='replace'),- 'limit': self.limit,+ 'limit': self.limit,'offset': currentOffset}headers = {'Accept': "application/json",'Authorization': "Bearer " + self.opts['api_key']}-+res = self.sf.fetchUrl('https://api.spyse.com/v3/data/domain/subdomain?' + urllib.parse.urlencode(params),headers=headers,@@ -122,7 +122,7 @@ class sfp_spyse(SpiderFootPlugin):def queryIPPort(self, qry, currentOffset):params = {'ip': qry.encode('raw_unicode_escape').decode("ascii", errors='replace'),- 'limit': self.limit,+ 'limit': self.limit,'offset': currentOffset}headers = {@@ -145,7 +145,7 @@ class sfp_spyse(SpiderFootPlugin):def queryDomainsOnIP(self, qry, currentOffset):params = {'ip': qry.encode('raw_unicode_escape').decode("ascii", errors='replace'),- 'limit': self.limit,+ 'limit': self.limit,'offset': currentOffset}headers = {@@ -169,7 +169,7 @@ class sfp_spyse(SpiderFootPlugin):def queryDomainsAsMX(self, qry, currentOffset):params = {'ip': qry.encode('raw_unicode_escape').decode("ascii", errors='replace'),- 'limit': self.limit,+ 'limit': self.limit,'offset': currentOffset}@@ -234,12 +234,11 @@ class sfp_spyse(SpiderFootPlugin):# Report extra data in the recorddef reportExtraData(self, record, event):-operatingSystem = record.get('operation_system')if operatingSystem is not None:evt = SpiderFootEvent('OPERATING_SYSTEM', str(operatingSystem), self.__name__, event)self.notifyListeners(evt)-+webServer = record.get('product')if webServer is not None:evt = SpiderFootEvent('WEBSERVER_BANNER', str(webServer), self.__name__, event)@@ -252,7 +251,7 @@ class sfp_spyse(SpiderFootPlugin):# Handle events sent to this moduledef handleEvent(self, event):-+if self.errorState:return None@@ -300,7 +299,7 @@ class sfp_spyse(SpiderFootPlugin):if domain:evt = SpiderFootEvent('RAW_RIR_DATA', str(record), self.__name__, event)self.notifyListeners(evt)-+cohosts.append(domain)self.reportExtraData(record, event)@@ -360,7 +359,7 @@ class sfp_spyse(SpiderFootPlugin):if port:evt = SpiderFootEvent('RAW_RIR_DATA', str(record), self.__name__, event)self.notifyListeners(evt)-+ports.append(str(eventData) + ":" + str(port))self.reportExtraData(record, event)@@ -368,16 +367,16 @@ class sfp_spyse(SpiderFootPlugin):if len(records) < self.limit:nextPageHasData = FalsecurrentOffset += self.limit-+for port in ports:if port in self.results:continueself.results[port] = True-+evt = SpiderFootEvent('TCP_PORT_OPEN', str(port), self.__name__, event)self.notifyListeners(evt)- # Query subdomains+ # Query subdomainsif eventName in ["DOMAIN_NAME", "INTERNET_NAME"]:currentOffset = 0nextPageHasData = True@@ -429,7 +428,7 @@ class sfp_spyse(SpiderFootPlugin):else:evt = SpiderFootEvent("INTERNET_NAME", domain, self.__name__, event)self.notifyListeners(evt)-+return None# End of sfp_spyse classdiff --git a/modules/sfp_talosintel.py b/modules/sfp_talosintel.pyindex 30f34905..68f92d79 100644--- a/modules/sfp_talosintel.py+++ b/modules/sfp_talosintel.py@@ -144,8 +144,8 @@ class sfp_talosintel(SpiderFootPlugin):try:if IPAddress(ip) in IPNetwork(target):- self.sf.debug(ip + " found within netblock/subnet " +- target + " in " + check)+ self.sf.debug(ip + " found within netblock/subnet "+ + target + " in " + check)return urlexcept Exception as e:self.sf.debug("Error encountered parsing: " + str(e))diff --git a/modules/sfp_template.py b/modules/sfp_template.pyindex 26502215..d672c694 100644--- a/modules/sfp_template.py+++ b/modules/sfp_template.py@@ -70,7 +70,7 @@ class sfp_template(SpiderFootPlugin):# - Investigate means that this module is useful when investigating the danger/risk of a target'useCases': ["Passive"],- # Categories: The categories this module belongs in, describing how it operates. Only the first category is+ # Categories: The categories this module belongs in, describing how it operates. Only the first category is# used for now.# - Content Analysis: Analyses content found# - Crawling and Scanning: Performs crawling or scanning of the target@@ -100,7 +100,7 @@ class sfp_template(SpiderFootPlugin):# The repo where the code of the tool lives.'repository': 'https://github.com/author/tool'},-+# Information about the data source (if any) this module queries for data. For modules# that purley parse data from other modules (e.g. sfp_email), this may be omitted.'dataSource': {@@ -108,7 +108,7 @@ class sfp_template(SpiderFootPlugin):'website': "https://www.datasource.com",# The subscription model for this data source.- # - FREE_NOAUTH_UNLIMITED: Completely free, no need to obtain an API key and no limits+ # - FREE_NOAUTH_UNLIMITED: Completely free, no need to obtain an API key and no limits# imposed beyond throttling.# - FREE_NOAUTH_LIMITED: Completely free, no need to obtain an API key however limits# are imposed and you need to register/pay to exceed them.@@ -213,7 +213,7 @@ class sfp_template(SpiderFootPlugin):self.sf = sfc# self.tempStorage() basically returns a dict(), but we use self.tempStorage()# instead since on SpiderFoot HX, different mechanisms are used to persist- # data for load distribution, avoiding excess memory consumption and fault+ # data for load distribution, avoiding excess memory consumption and fault# tolerance. This keeps modules transparently compatible with both versions.self.results = self.tempStorage()@@ -250,9 +250,8 @@ class sfp_template(SpiderFootPlugin):# from global config), and the user agent is SpiderFoot so that the# provider knows the request comes from the tool. Many third parties# request that, so best to just be consistent anyway.- res = self.sf.fetchUrl("https://api.shodan.io/shodan/host/" + qry +- "?key=" + self.opts['api_key'],- timeout=self.opts['_fetchtimeout'],+ res = self.sf.fetchUrl("https://api.shodan.io/shodan/host/" + qry + "?key=" + self.opts['api_key'],+ timeout=self.opts['_fetchtimeout'],useragent="SpiderFoot")# Report when unexpected things happen:@@ -315,9 +314,9 @@ class sfp_template(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return None@@ -380,7 +379,7 @@ class sfp_template(SpiderFootPlugin):return None# In some cases, you want to override the data source for the event- # you're producing to be the data source of the event that you've+ # you're producing to be the data source of the event that you've# received. This is needed, for example, when the module is purely# extracting data from a received event, so the data source is not# actually this module, but the data source of the received eventdiff --git a/modules/sfp_threatcrowd.py b/modules/sfp_threatcrowd.pyindex e8f55eba..c374080c 100644--- a/modules/sfp_threatcrowd.py+++ b/modules/sfp_threatcrowd.py@@ -145,9 +145,9 @@ class sfp_threatcrowd(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return Noneif eventName == 'NETBLOCK_MEMBER':@@ -155,9 +155,9 @@ class sfp_threatcrowd(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return Noneqrylist = list()@@ -198,8 +198,7 @@ class sfp_threatcrowd(SpiderFootPlugin):infourl = "<SFURL>" + info.get('permalink') + "</SFURL>"# Notify other modules of what you've found- e = SpiderFootEvent(evt, "ThreatCrowd [" + addr + "]\n" +- infourl, self.__name__, event)+ e = SpiderFootEvent(evt, "ThreatCrowd [" + addr + "]\n" + infourl, self.__name__, event)self.notifyListeners(e)# End of sfp_threatcrowd classdiff --git a/modules/sfp_threatminer.py b/modules/sfp_threatminer.pyindex 768ecc4b..a2991f0d 100644--- a/modules/sfp_threatminer.py+++ b/modules/sfp_threatminer.py@@ -144,9 +144,9 @@ class sfp_threatminer(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return Noneif eventName == 'NETBLOCK_MEMBER':@@ -154,9 +154,9 @@ class sfp_threatminer(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return Noneqrylist = list()diff --git a/modules/sfp_tool_nmap.py b/modules/sfp_tool_nmap.pyindex 9d562bbc..a09649e6 100644--- a/modules/sfp_tool_nmap.py+++ b/modules/sfp_tool_nmap.py@@ -95,8 +95,7 @@ class sfp_tool_nmap(SpiderFootPlugin):return Noneexcept BaseException as e:- self.sf.error("Strange netblock identified, unable to parse: " +- eventData + " (" + str(e) + ")", False)+ self.sf.error("Strange netblock identified, unable to parse: " + eventData + " (" + str(e) + ")", False)return None# Don't look up stuff twice, check IP == IP herediff --git a/modules/sfp_torexits.py b/modules/sfp_torexits.pyindex 78d3a3ff..20743caf 100644--- a/modules/sfp_torexits.py+++ b/modules/sfp_torexits.py@@ -129,8 +129,7 @@ class sfp_torexits(SpiderFootPlugin):try:if IPAddress(ip) in IPNetwork(target):- self.sf.debug(ip + " found within netblock/subnet " +- target + " in " + check)+ self.sf.debug(ip + " found within netblock/subnet " + target + " in " + check)return urlexcept Exception as e:self.sf.debug("Error encountered parsing: " + str(e))diff --git a/modules/sfp_twilio.py b/modules/sfp_twilio.pyindex fd530dcc..18689f71 100644--- a/modules/sfp_twilio.py+++ b/modules/sfp_twilio.py@@ -16,7 +16,7 @@ import jsonclass sfp_twilio(SpiderFootPlugin):"""Twilio:Footprint,Investigate,Passive:Search Engines:apikey:Obtain information from Twilio about phone numbers. Ensure you have the Caller Name add-on installed in Twilio."""-+meta = {'name': "Twilio",'summary': "Obtain information from Twilio about phone numbers. Ensure you have the Caller Name add-on installed in Twilio.",@@ -73,8 +73,8 @@ class sfp_twilio(SpiderFootPlugin):# When querying third parties, it's best to have a dedicated function# to do so and avoid putting it in handleEvent()- def queryPhoneNumber(self, phoneNumber):-+ def queryPhoneNumber(self, phoneNumber):+token = (base64.b64encode(self.opts['api_key_account_sid'].encode('utf8') + ":".encode('utf-8') + self.opts['api_key_auth_token'].encode('utf-8'))).decode('utf-8')headers = {@@ -92,11 +92,11 @@ class sfp_twilio(SpiderFootPlugin):if res['code'] == '400':self.sf.error("Bad request.", False)return None-+if res['code'] == '404':self.sf.debug("Phone number not found.")return None-+if res['code'] == '429':self.sf.error("API usage limit reached.", False)return None@@ -137,23 +137,23 @@ class sfp_twilio(SpiderFootPlugin):self.results[eventData] = Truecontent = self.queryPhoneNumber(eventData)-+if content is None:return None-+data = json.loads(content)evt = SpiderFootEvent("RAW_RIR_DATA", str(data), self.__name__, event)self.notifyListeners(evt)-+callerName = data.get('caller_name')if callerName:callerName = callerName.get('caller_name')-+if callerName:evt = SpiderFootEvent("COMPANY_NAME", callerName, self.__name__, event)- self.notifyListeners(evt)+ self.notifyListeners(evt)return None-+# End of sfp_twilio classdiff --git a/modules/sfp_twitter.py b/modules/sfp_twitter.pyindex 9d5b6a23..896b6ceb 100644--- a/modules/sfp_twitter.py+++ b/modules/sfp_twitter.py@@ -76,8 +76,7 @@ class sfp_twitter(SpiderFootPlugin):network = eventData.split(": ")[0]url = eventData.split(": ")[1].replace("<SFURL>", "").replace("</SFURL>", "")except BaseException as e:- self.sf.error("Unable to parse SOCIAL_MEDIA: " +- eventData + " (" + str(e) + ")", False)+ self.sf.error(f"Unable to parse SOCIAL_MEDIA: {eventData} ({e})", False)return Noneif not network == "Twitter":diff --git a/modules/sfp_uceprotect.py b/modules/sfp_uceprotect.pyindex cd17fcc0..67fdc8e0 100644--- a/modules/sfp_uceprotect.py+++ b/modules/sfp_uceprotect.py@@ -156,9 +156,9 @@ class sfp_uceprotect(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return Noneif eventName == 'NETBLOCK_MEMBER':@@ -166,9 +166,9 @@ class sfp_uceprotect(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return Noneif eventName.startswith("NETBLOCK_"):diff --git a/modules/sfp_virustotal.py b/modules/sfp_virustotal.pyindex d5374486..241c79ca 100644--- a/modules/sfp_virustotal.py+++ b/modules/sfp_virustotal.py@@ -163,9 +163,9 @@ class sfp_virustotal(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return Noneif eventName == 'NETBLOCK_MEMBER':@@ -173,9 +173,9 @@ class sfp_virustotal(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return Noneqrylist = list()@@ -219,8 +219,7 @@ class sfp_virustotal(SpiderFootPlugin):addr + "/information/</SFURL>"# Notify other modules of what you've found- e = SpiderFootEvent(evt, "VirusTotal [" + addr + "]\n" +- infourl, self.__name__, event)+ e = SpiderFootEvent(evt, "VirusTotal [" + addr + "]\n" + infourl, self.__name__, event)self.notifyListeners(e)# Treat siblings as affiliates if they are of the original target, otherwisediff --git a/modules/sfp_voipbl.py b/modules/sfp_voipbl.pyindex df9368a6..5844f42a 100644--- a/modules/sfp_voipbl.py+++ b/modules/sfp_voipbl.py@@ -141,11 +141,10 @@ class sfp_voipbl(SpiderFootPlugin):try:if IPAddress(ip) in IPNetwork(target):- self.sf.debug(ip + " found within netblock/subnet " +- target + " in " + check)+ self.sf.debug(f"{ip} found within netblock/subnet {target} in {check}")return urlexcept Exception as e:- self.sf.debug("Error encountered parsing: " + str(e))+ self.sf.debug(f"Error encountered parsing: {e}")continuereturn Nonediff --git a/modules/sfp_vxvault.py b/modules/sfp_vxvault.pyindex 4ffd78d4..a9570629 100644--- a/modules/sfp_vxvault.py+++ b/modules/sfp_vxvault.py@@ -142,11 +142,10 @@ class sfp_vxvault(SpiderFootPlugin):try:if IPAddress(ip) in IPNetwork(target):- self.sf.debug(ip + " found within netblock/subnet " +- target + " in " + check)+ self.sf.debug(f"{ip} found within netblock/subnet {target} in {check}")return urlexcept Exception as e:- self.sf.debug("Error encountered parsing: " + str(e))+ self.sf.debug(f"Error encountered parsing: {e}")continuereturn Nonediff --git a/modules/sfp_xforce.py b/modules/sfp_xforce.pyindex 00cd5711..3cb07ed3 100644--- a/modules/sfp_xforce.py+++ b/modules/sfp_xforce.py@@ -209,9 +209,9 @@ class sfp_xforce(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxnetblock']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxnetblock']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxnetblock']))return Noneif eventName == 'NETBLOCK_MEMBER':@@ -219,9 +219,9 @@ class sfp_xforce(SpiderFootPlugin):return Noneelse:if IPNetwork(eventData).prefixlen < self.opts['maxsubnet']:- self.sf.debug("Network size bigger than permitted: " +- str(IPNetwork(eventData).prefixlen) + " > " +- str(self.opts['maxsubnet']))+ self.sf.debug("Network size bigger than permitted: "+ + str(IPNetwork(eventData).prefixlen) + " > "+ + str(self.opts['maxsubnet']))return Noneif eventName.startswith('AFFILIATE_') and not self.opts.get('checkaffiliates', False):@@ -305,10 +305,7 @@ class sfp_xforce(SpiderFootPlugin):if cats is not None:for cat in cats:cats_description = cats_description + cat + " "- entry = reason + infield_sep + \- str(score) + infield_sep + \- created + infield_sep + \- cats_description+ entry = f"{reason}{infield_sep}{score}{infield_sep}{created}{infield_sep}{cats_description}"e = SpiderFootEvent(evtType, entry, self.__name__, event)self.notifyListeners(e)diff --git a/setup.cfg b/setup.cfgindex 0704a208..b5bce099 100644--- a/setup.cfg+++ b/setup.cfg@@ -1,3 +1,3 @@[flake8]flake8-max-line-length = 120-ignore = F841 E501 E131 E401 E201 E302 E265 W605 W293 W291 W504 E121 E226 E722 E127 E741 E126 E711 E303 E502 E123 E301 E125 E262 E227 E231 E221 E712 W391 W503 E731+ignore = F841 E501 E131 E401 E201 E302 E265 W605 W504 E121 E226 E722 E127 E741 E126 E711 E303 E502 E123 E301 E125 E262 E227 E231 E712 W391 W503 E731 W291 W293diff --git a/sfscan.py b/sfscan.pyindex f9da48cd..94575182 100644--- a/sfscan.py+++ b/sfscan.py@@ -341,17 +341,17 @@ class SpiderFootScanner():breakif aborted:- self.__sf.status("Scan [" + self.__scanId + "] aborted.")+ self.__sf.status(f"Scan [{self.__scanId}] aborted.")self.__setStatus("ABORTED", None, time.time() * 1000)else:- self.__sf.status("Scan [" + self.__scanId + "] completed.")+ self.__sf.status(f"Scan [{self.__scanId}] completed.")self.__setStatus("FINISHED", None, time.time() * 1000)except BaseException as e:exc_type, exc_value, exc_traceback = sys.exc_info()- self.__sf.error("Unhandled exception (" + e.__class__.__name__ + ") " +- "encountered during scan. Please report this as a bug: " +- repr(traceback.format_exception(exc_type, exc_value, exc_traceback)), False)- self.__sf.status("Scan [" + self.__scanId + "] failed: " + str(e))+ self.__sf.error(f"Unhandled exception ({e.__class__.__name__}) encountered during scan."+ + "Please report this as a bug: "+ + repr(traceback.format_exception(exc_type, exc_value, exc_traceback)), False)+ self.__sf.status(f"Scan [{self.__scanId}] failed: {e}")self.__setStatus("ERROR-FAILED", None, time.time() * 1000)self.__dbh.close()