Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

sfp_alienvaultiprep: Report blocked hosts as blacklisted (#1513)

bcoles0c55be47188b
diff --git a/modules/sfp_alienvaultiprep.py b/modules/sfp_alienvaultiprep.py
index a52d4fe8..b0d4d075 100644
--- a/modules/sfp_alienvaultiprep.py
+++ b/modules/sfp_alienvaultiprep.py
@@ -28,11 +28,8 @@ class sfp_alienvaultiprep(SpiderFootPlugin):
'model': "FREE_NOAUTH_UNLIMITED",
'references': [
"https://cybersecurity.att.com/documentation/",
- "https://cybersecurity.att.com/resource-center#content_solution-brief",
- "https://cybersecurity.att.com/resource-center#content_data-sheet",
- "https://cybersecurity.att.com/resource-center#content_case-studies",
- "https://cybersecurity.att.com/training",
- "https://cybersecurity.att.com/pricing/request-quote"
+ "https://cybersecurity.att.com/resource-center",
+ "https://success.alienvault.com/s/article/Can-I-use-the-OTX-IP-Reputation-List-as-a-blocklist",
],
'favIcon': "https://cdn-cybersecurity.att.com/images/uploads/logos/att-globe.svg",
'logo': "https://cdn-cybersecurity.att.com/images/uploads/logos/att-business-web.svg",
@@ -70,7 +67,6 @@ class sfp_alienvaultiprep(SpiderFootPlugin):
for opt in list(userOpts.keys()):
self.opts[opt] = userOpts[opt]
- # What events is this module interested in for input
def watchedEvents(self):
return [
"IP_ADDRESS",
@@ -79,13 +75,16 @@ class sfp_alienvaultiprep(SpiderFootPlugin):
"NETBLOCK_OWNER"
]
- # What events this module produces
def 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):
@@ -160,10 +159,9 @@ class sfp_alienvaultiprep(SpiderFootPlugin):
# Handle events sent to this module
def handleEvent(self, event):
eventName = event.eventType
- srcModuleName = event.module
eventData = 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_alienvaultiprep(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):
return
targetType = 'ip'
- evtType = 'MALICIOUS_AFFILIATE_IPADDR'
+ malicious_type = "MALICIOUS_AFFFILIATE_IPADDR"
+ blacklist_type = "BLACKLISTED_AFFILIATE_IPADDR"
elif eventName == 'NETBLOCK_OWNER':
if not self.opts.get('checknetblocks', False):
return
targetType = 'netblock'
- evtType = 'MALICIOUS_NETBLOCK'
+ malicious_type = "MALICIOUS_NETBLOCK"
+ blacklist_type = "BLACKLISTED_NETBLOCK"
elif eventName == 'NETBLOCK_MEMBER':
if not self.opts.get('checksubnets', False):
return
targetType = 'netblock'
- evtType = 'MALICIOUS_SUBNET'
+ malicious_type = "MALICIOUS_SUBNET"
+ blacklist_type = "BLACKLISTED_SUBNET"
else:
+ self.debug(f"Unexpected event type {eventName}, skipping")
return
self.debug(f"Checking maliciousness of {eventData} ({eventName}) with AlienVault IP Reputation Database")
- if self.queryBlacklist(eventData, targetType):
- url = "https://reputation.alienvault.com/reputation.generic"
- text = f"AlienVault IP Reputation Database [{eventData}]\n<SFURL>{url}</SFURL>"
- evt = SpiderFootEvent(evtType, text, self.__name__, event)
- self.notifyListeners(evt)
+ if not self.queryBlacklist(eventData, targetType):
+ return
+
+ url = "https://reputation.alienvault.com/reputation.generic"
+ text = f"AlienVault IP Reputation Database [{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_alienvaultiprep class