Skip to content

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

sfp_botvrij: Report blocked hosts as blacklisted (#1567)

bcoles2faa2e9def37
diff --git a/modules/sfp_botvrij.py b/modules/sfp_botvrij.py
index 904365b0..8461e963 100644
--- a/modules/sfp_botvrij.py
+++ b/modules/sfp_botvrij.py
@@ -32,14 +32,12 @@ class sfp_botvrij(SpiderFootPlugin):
}
}
- # Default options
opts = {
'checkaffiliates': True,
'checkcohosts': True,
'cacheperiod': 18
}
- # Option descriptions
optdescs = {
'checkaffiliates': "Apply checks to affiliates?",
'checkcohosts': "Apply checks to sites found to be co-hosted on the target's IP?",
@@ -57,20 +55,21 @@ class sfp_botvrij(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 [
"INTERNET_NAME",
"AFFILIATE_INTERNET_NAME",
- "CO_HOSTED_SITE"
+ "CO_HOSTED_SITE",
]
- # What events this module produces
def 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):
@@ -138,13 +137,11 @@ class sfp_botvrij(SpiderFootPlugin):
return hosts
- # 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.")
@@ -156,24 +153,34 @@ class sfp_botvrij(SpiderFootPlugin):
self.results[eventData] = True
if 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")
return
self.debug(f"Checking maliciousness of {eventData} ({eventName}) with botvrij.eu")
- if self.queryBlacklist(eventData):
- url = "https://www.botvrij.eu/data/blocklist/blocklist_full.csv"
- text = f"botvrij.eu Domain Blocklist [{eventData}]\n<SFURL>{url}</SFURL>"
- evt = SpiderFootEvent(evtType, text, self.__name__, event)
- self.notifyListeners(evt)
+ if not self.queryBlacklist(eventData):
+ return
+
+ url = "https://www.botvrij.eu/data/blocklist/blocklist_full.csv"
+ text = f"botvrij.eu Domain Blocklist [{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_botvrij class