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: E127
Brendan Coles04f23bdf18a6
diff --git a/modules/sfp_accounts.py b/modules/sfp_accounts.pyindex a393b850..f59903a5 100644--- a/modules/sfp_accounts.py+++ b/modules/sfp_accounts.py@@ -104,8 +104,7 @@ class sfp_accounts(SpiderFootPlugin):return Noneurl = site['check_uri'].format(account=name)- retname = site['name'] + " (Category: " + site['category'] + ")\n<SFURL>" + \- url + "</SFURL>"+ retname = f"{site['name']} (Category: {site['category']})\n<SFURL>{url}</SFURL>"res = self.sf.fetchUrl(url, timeout=self.opts['_fetchtimeout'],useragent=self.opts['_useragent'], noLog=True, verify=False)diff --git a/modules/sfp_clearbit.py b/modules/sfp_clearbit.pyindex 55d4afa9..c25efcad 100644--- a/modules/sfp_clearbit.py+++ b/modules/sfp_clearbit.py@@ -81,7 +81,7 @@ class sfp_clearbit(SpiderFootPlugin):# What events this module producesdef producedEvents(self):return ["RAW_RIR_DATA", "PHONE_NUMBER", "PHYSICAL_ADDRESS",- "AFFILIATE_INTERNET_NAME", "EMAILADDR", "EMAILADDR_GENERIC"]+ "AFFILIATE_INTERNET_NAME", "EMAILADDR", "EMAILADDR_GENERIC"]def query(self, t):ret = Nonediff --git a/modules/sfp_dnszonexfer.py b/modules/sfp_dnszonexfer.pyindex beaa6f1c..59c98721 100644--- a/modules/sfp_dnszonexfer.py+++ b/modules/sfp_dnszonexfer.py@@ -128,6 +128,6 @@ class sfp_dnszonexfer(SpiderFootPlugin):except BaseException as e:self.sf.info("Unable to perform DNS zone transfer for " + eventData +- "(" + name + "): " + str(e))+ "(" + name + "): " + str(e))# End of sfp_dnszonexfer classdiff --git a/modules/sfp_fullcontact.py b/modules/sfp_fullcontact.pyindex 239bf704..f8687160 100644--- a/modules/sfp_fullcontact.py+++ b/modules/sfp_fullcontact.py@@ -87,7 +87,7 @@ class sfp_fullcontact(SpiderFootPlugin):# What events this module producesdef producedEvents(self):return ["EMAILADDR", "EMAILADDR_GENERIC", "RAW_RIR_DATA",- "PHONE_NUMBER", "GEOINFO", "PHYSICAL_ADDRESS"]+ "PHONE_NUMBER", "GEOINFO", "PHYSICAL_ADDRESS"]def query(self, url, data, failcount=0):header = "Bearer " + self.opts['api_key']diff --git a/modules/sfp_names.py b/modules/sfp_names.pyindex a4e83b92..44686eeb 100644--- a/modules/sfp_names.py+++ b/modules/sfp_names.py@@ -106,9 +106,9 @@ class sfp_names(SpiderFootPlugin):# expect to see RELEVANT names within.if eventName == "RAW_RIR_DATA":if srcModuleName not in ["sfp_arin", "sfp_builtwith", "sfp_clearbit",- "sfp_fullcontact", "sfp_github", "sfp_hunter",- "sfp_opencorporates", "sfp_slideshare",- "sfp_twitter", "sfp_venmo", "sfp_instagram"]:+ "sfp_fullcontact", "sfp_github", "sfp_hunter",+ "sfp_opencorporates", "sfp_slideshare",+ "sfp_twitter", "sfp_venmo", "sfp_instagram"]:self.sf.debug("Ignoring RAW_RIR_DATA from untrusted module.")return Nonediff --git a/modules/sfp_onioncity.py b/modules/sfp_onioncity.pyindex 1b49ffc9..3928b1fb 100644--- a/modules/sfp_onioncity.py+++ b/modules/sfp_onioncity.py@@ -144,8 +144,8 @@ class sfp_onioncity(SpiderFootPlugin):torlink = link.replace(".onion.link", ".onion")if self.opts['fetchlinks']:res = self.sf.fetchUrl(torlink, timeout=self.opts['_fetchtimeout'],- useragent=self.opts['_useragent'],- verify=False)+ useragent=self.opts['_useragent'],+ verify=False)if res['content'] is None:self.sf.debug("Ignoring " + link + " as no data returned")@@ -153,7 +153,7 @@ class sfp_onioncity(SpiderFootPlugin):# Sometimes onion city search results false positivesif re.search(r"[^a-zA-Z\-\_0-9]" + re.escape(eventData) +- r"[^a-zA-Z\-\_0-9]", res['content'], re.IGNORECASE) is None:+ r"[^a-zA-Z\-\_0-9]", res['content'], re.IGNORECASE) is None:self.sf.debug("Ignoring " + link + " as no mention of " + eventData)continue@@ -169,7 +169,7 @@ class sfp_onioncity(SpiderFootPlugin):data = res['content'][startIndex:endIndex]evt = SpiderFootEvent("DARKNET_MENTION_CONTENT", "..." + data + "...",- self.__name__, evt)+ self.__name__, evt)self.notifyListeners(evt)else:evt = SpiderFootEvent("DARKNET_MENTION_URL", torlink, self.__name__, event)diff --git a/modules/sfp_pastebin.py b/modules/sfp_pastebin.pyindex 6c219659..d9352645 100644--- a/modules/sfp_pastebin.py+++ b/modules/sfp_pastebin.py@@ -137,7 +137,7 @@ class sfp_pastebin(SpiderFootPlugin):return Noneres = self.sf.fetchUrl(link, timeout=self.opts['_fetchtimeout'],- useragent=self.opts['_useragent'])+ useragent=self.opts['_useragent'])if res['content'] is None:self.sf.debug("Ignoring " + link + " as no data returned")@@ -145,7 +145,7 @@ class sfp_pastebin(SpiderFootPlugin):# Sometimes pastes search results false positivesif re.search(r"[^a-zA-Z\-\_0-9]" + re.escape(eventData) +- r"[^a-zA-Z\-\_0-9]", res['content'], re.IGNORECASE) is None:+ r"[^a-zA-Z\-\_0-9]", res['content'], re.IGNORECASE) is None:continuetry:diff --git a/modules/sfp_tool_cmseek.py b/modules/sfp_tool_cmseek.pyindex cb9c7048..f1fdb9c7 100644--- a/modules/sfp_tool_cmseek.py+++ b/modules/sfp_tool_cmseek.py@@ -130,7 +130,7 @@ class sfp_tool_cmseek(SpiderFootPlugin):f = io.open(resultpath + "/" + eventData + "/cms.json", encoding='utf-8')j = json.loads(f.read())evt = SpiderFootEvent("WEBSERVER_TECHNOLOGY", j['cms_name'],- self.__name__, event)+ self.__name__, event)self.notifyListeners(evt)except BaseException as e:self.sf.error("Couldn't parse the JSON output of CMSeeK: " + str(e), False)diff --git a/modules/sfp_tool_dnstwist.py b/modules/sfp_tool_dnstwist.pyindex b705291d..841cb554 100644--- a/modules/sfp_tool_dnstwist.py+++ b/modules/sfp_tool_dnstwist.py@@ -129,7 +129,7 @@ class sfp_tool_dnstwist(SpiderFootPlugin):continueevt = SpiderFootEvent("SIMILARDOMAIN", r['domain-name'],- self.__name__, event)+ self.__name__, event)self.notifyListeners(evt)except BaseException as e:self.sf.error("Couldn't parse the JSON output of DNSTwist: " + str(e), False)diff --git a/modules/sfp_wikileaks.py b/modules/sfp_wikileaks.pyindex f80d6149..d1b5fd3c 100644--- a/modules/sfp_wikileaks.py+++ b/modules/sfp_wikileaks.py@@ -96,11 +96,11 @@ class sfp_wikileaks(SpiderFootPlugin):maxDate = ""qdata = eventData.replace(" ", "+")- wlurl = "https://search.wikileaks.org/?query=%22" + qdata + "%22" + \- "&released_date_start=" + maxDate + "&include_external_sources=" + \- external + "&new_search=True&order_by=most_relevant#results"+ wlurl = "query=%22" + qdata + "%22" + "&released_date_start=" + maxDate + "&include_external_sources=" + external + "&new_search=True&order_by=most_relevant#results"- res = self.sf.fetchUrl(wlurl)+ res = self.sf.fetchUrl(+ "https://search.wikileaks.org/?" + wlurl+ )if res['content'] is None:self.sf.error("Unable to fetch Wikileaks content.", False)return Nonediff --git a/modules/sfp_xforce.py b/modules/sfp_xforce.pyindex cd4b80cf..68495ba7 100644--- a/modules/sfp_xforce.py+++ b/modules/sfp_xforce.py@@ -301,9 +301,12 @@ class sfp_xforce(SpiderFootPlugin):if int(score) < 2:self.sf.debug("Non-malicious results, skipping.")continue+if cats is not None:for cat in cats:cats_description = cats_description + cat + " "++ # TODO: use join with infield_sep as delimeterentry = f"{reason}{infield_sep}{score}{infield_sep}{created}{infield_sep}{cats_description}"e = SpiderFootEvent(evtType, entry, self.__name__, event)self.notifyListeners(e)@@ -326,29 +329,29 @@ class sfp_xforce(SpiderFootPlugin):firstseen = result.get("first", "")family = result.get("family", None)family_description = ""+if family is not None:for f in family:family_description = family_description + f + " "- entry = origin + infield_sep + \- family_description + infield_sep + \- md5 + infield_sep + \- domain + infield_sep + \- uri + infield_sep + \- firstseen + infield_sep + \- lastseen++ # TODO: use join with infield_sep as delimeter+ entry = f"{origin}{infield_sep}{family_description}{infield_sep}{md5}{infield_sep}{domain}{infield_sep}{uri}{infield_sep}{firstseen}{infield_sep}{lastseen}"last = rec.get("last", None)+if not last:continue+last_dt = datetime.strptime(last, '%Y-%m-%dT%H:%M:%S.000Z')last_ts = int(time.mktime(last_dt.timetuple()))age_limit_ts = int(time.time()) - (86400 * self.opts['age_limit_days'])host = rec['value']+if self.opts['age_limit_days'] > 0 and last_ts < age_limit_ts:self.sf.debug("Record found but too old, skipping.")continue- else:- e = SpiderFootEvent(evtType, entry, self.__name__, event)- self.notifyListeners(e)++ e = SpiderFootEvent(evtType, entry, self.__name__, event)+ self.notifyListeners(e)# End of sfp_xforce classdiff --git a/setup.cfg b/setup.cfgindex b12eda7c..13236781 100644--- a/setup.cfg+++ b/setup.cfg@@ -1,3 +1,3 @@[flake8]flake8-max-line-length = 120-ignore = F841 E501 W503 E131 E401 E201 E302 E265 W605 W504 E226 E722 E127 E741 E502+ignore = F841 E501 W503 E131 E401 E201 E302 E265 W605 W504 E226 E722 E741 E502diff --git a/test/unit/test_spiderfoot_module_loading.py b/test/unit/test_spiderfoot_module_loading.pyindex 9bf39a74..780a9081 100644--- a/test/unit/test_spiderfoot_module_loading.py+++ b/test/unit/test_spiderfoot_module_loading.py@@ -76,9 +76,9 @@ class TestSpiderFootModuleLoading(unittest.TestCase):valid_use_cases = ["Footprint", "Passive", "Investigate"]valid_categories = ["Content Analysis", "Crawling and Scanning", "DNS",- "Leaks, Dumps and Breaches", "Passive DNS",- "Public Registries", "Real World", "Reputation Systems",- "Search Engines", "Secondary Networks", "Social Media"]+ "Leaks, Dumps and Breaches", "Passive DNS",+ "Public Registries", "Real World", "Reputation Systems",+ "Search Engines", "Secondary Networks", "Social Media"]for module in sfModules:m = sfModules[module]