SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
sfp_openphish: Report blocked hosts as blacklisted (#1566)
bcoles4ee93623d9f4
diff --git a/modules/sfp_openphish.py b/modules/sfp_openphish.pyindex 9cf03692..4170f286 100644--- a/modules/sfp_openphish.py+++ b/modules/sfp_openphish.py@@ -37,14 +37,12 @@ class sfp_openphish(SpiderFootPlugin):}}- # Default optionsopts = {'checkaffiliates': True,'checkcohosts': True,'cacheperiod': 18}- # Option descriptionsoptdescs = {'checkaffiliates': "Apply checks to affiliates?",'checkcohosts': "Apply checks to sites found to be co-hosted on the target's IP?",@@ -62,20 +60,21 @@ class sfp_openphish(SpiderFootPlugin):for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]- # What events is this module interested in for inputdef watchedEvents(self):return ["INTERNET_NAME","AFFILIATE_INTERNET_NAME",- "CO_HOSTED_SITE"+ "CO_HOSTED_SITE",]- # What events this module producesdef producedEvents(self):return [+ "BLACKLISTED_INTERNET_NAME",+ "BLACKLISTED_AFFILIATE_INTERNET_NAME",+ "BLACKLISTED_COHOST","MALICIOUS_INTERNET_NAME","MALICIOUS_AFFILIATE_INTERNET_NAME",- "MALICIOUS_COHOST"+ "MALICIOUS_COHOST",]def queryBlacklist(self, target):@@ -149,13 +148,11 @@ class sfp_openphish(SpiderFootPlugin):return hosts- # Handle events sent to this moduledef handleEvent(self, event):eventName = event.eventType- srcModuleName = event.moduleeventData = event.data- self.debug(f"Received event, {eventName}, from {srcModuleName}")+ self.debug(f"Received event, {eventName}, from {event.module}")if eventData in self.results:self.debug(f"Skipping {eventData}, already checked.")@@ -167,24 +164,34 @@ class sfp_openphish(SpiderFootPlugin):self.results[eventData] = Trueif eventName == "INTERNET_NAME":- evtType = "MALICIOUS_INTERNET_NAME"- elif eventName == 'AFFILIATE_INTERNET_NAME':+ malicious_type = "MALICIOUS_INTERNET_NAME"+ blacklist_type = "BLACKLISTED_INTERNET_NAME"+ elif eventName == "AFFILIATE_INTERNET_NAME":if not self.opts.get('checkaffiliates', False):return- evtType = 'MALICIOUS_AFFILIATE_INTERNET_NAME'- elif eventName == 'CO_HOSTED_SITE':+ malicious_type = "MALICIOUS_AFFILIATE_INTERNET_NAME"+ blacklist_type = "BLACKLISTED_AFFILIATE_INTERNET_NAME"+ elif eventName == "CO_HOSTED_SITE":if not self.opts.get('checkcohosts', False):return- evtType = 'MALICIOUS_COHOST'+ malicious_type = "MALICIOUS_COHOST"+ blacklist_type = "BLACKLISTED_COHOST"else:+ self.debug(f"Unexpected event type {eventName}, skipping")returnself.debug(f"Checking maliciousness of {eventData} ({eventName}) with OpenPhish")- if self.queryBlacklist(eventData):- url = "https://www.openphish.com/feed.txt"- text = f"OpenPhish [{eventData}]\n<SFURL>{url}</SFURL>"- evt = SpiderFootEvent(evtType, text, self.__name__, event)- self.notifyListeners(evt)+ if not self.queryBlacklist(eventData):+ return++ url = "https://www.openphish.com/feed.txt"+ text = f"OpenPhish [{eventData}]\n<SFURL>{url}</SFURL>"++ evt = SpiderFootEvent(malicious_type, text, self.__name__, event)+ self.notifyListeners(evt)++ evt = SpiderFootEvent(blacklist_type, text, self.__name__, event)+ self.notifyListeners(evt)# End of sfp_openphish class