SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
sfp_voipbl: Report blocked hosts as blacklisted (#1541)
bcolesf510f0ecad70
diff --git a/modules/sfp_voipbl.py b/modules/sfp_voipbl.pyindex 2d47e5f7..eca46b51 100644--- a/modules/sfp_voipbl.py+++ b/modules/sfp_voipbl.py@@ -38,7 +38,6 @@ class sfp_voipbl(SpiderFootPlugin):}}- # Default optionsopts = {'checkaffiliates': True,'cacheperiod': 18,@@ -46,7 +45,6 @@ class sfp_voipbl(SpiderFootPlugin):'checksubnets': True}- # Option descriptionsoptdescs = {'checkaffiliates': "Apply checks to affiliates?",'cacheperiod': "Hours to cache list data before re-fetching.",@@ -65,22 +63,24 @@ class sfp_voipbl(SpiderFootPlugin):for opt in list(userOpts.keys()):self.opts[opt] = userOpts[opt]- # What events is this module interested in for inputdef watchedEvents(self):return ["IP_ADDRESS","AFFILIATE_IPADDR","NETBLOCK_MEMBER",- "NETBLOCK_OWNER"+ "NETBLOCK_OWNER",]- # What events this module producesdef producedEvents(self):return [+ "BLACKLISTED_IPADDR",+ "BLACKLISTED_AFFILIATE_IPADDR",+ "BLACKLISTED_SUBNET",+ "BLACKLISTED_NETBLOCK","MALICIOUS_IPADDR","MALICIOUS_AFFILIATE_IPADDR","MALICIOUS_SUBNET",- "MALICIOUS_NETBLOCK"+ "MALICIOUS_NETBLOCK",]def queryBlacklist(self, target, targetType):@@ -157,13 +157,11 @@ class sfp_voipbl(SpiderFootPlugin):return ips- # 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.")@@ -176,31 +174,42 @@ class sfp_voipbl(SpiderFootPlugin):if eventName == 'IP_ADDRESS':targetType = 'ip'- evtType = 'MALICIOUS_IPADDR'+ malicious_type = "MALICIOUS_IPADDR"+ blacklist_type = "BLACKLISTED_IPADDR"elif eventName == 'AFFILIATE_IPADDR':if not self.opts.get('checkaffiliates', False):returntargetType = 'ip'- evtType = 'MALICIOUS_AFFILIATE_IPADDR'+ malicious_type = "MALICIOUS_AFFILIATE_IPADDR"+ blacklist_type = "BLACKLISTED_AFFILIATE_IPADDR"elif eventName == 'NETBLOCK_OWNER':if not self.opts.get('checknetblocks', False):returntargetType = 'netblock'- evtType = 'MALICIOUS_NETBLOCK'+ malicious_type = "MALICIOUS_NETBLOCK"+ blacklist_type = "BLACKLISTED_NETBLOCK"elif eventName == 'NETBLOCK_MEMBER':if not self.opts.get('checksubnets', False):returntargetType = 'netblock'- evtType = 'MALICIOUS_SUBNET'+ malicious_type = "MALICIOUS_SUBNET"+ blacklist_type = "BLACKLISTED_SUBNET"else:+ self.debug(f"Unexpected event type {eventName}, skipping")returnself.debug(f"Checking maliciousness of {eventData} ({eventName}) with VoIP Blacklist (VoIPBL)")- if self.queryBlacklist(eventData, targetType):- url = "https://voipbl.org/update"- text = f"VoIP Blacklist (VoIPBL) [{eventData}]\n<SFURL>{url}</SFURL>"- evt = SpiderFootEvent(evtType, text, self.__name__, event)- self.notifyListeners(evt)+ if not self.queryBlacklist(eventData, targetType):+ return++ url = f"https://voipbl.org/check/?ip={eventData}"+ text = f"VoIP Blacklist (VoIPBL) [{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_voipbl class