Skip to content

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

sfp_opendns: Report blocked hosts as blacklisted (#1504)

bcolesb593f076ced1
diff --git a/modules/sfp_opendns.py b/modules/sfp_opendns.py
index e5a28a12..af05915f 100644
--- a/modules/sfp_opendns.py
+++ b/modules/sfp_opendns.py
@@ -75,9 +75,12 @@ class sfp_opendns(SpiderFootPlugin):
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 queryAddr(self, qaddr):
@@ -106,11 +109,14 @@ class sfp_opendns(SpiderFootPlugin):
self.results[eventData] = True
if eventName == "INTERNET_NAME":
- e = "MALICIOUS_INTERNET_NAME"
+ malicious_type = "MALICIOUS_INTERNET_NAME"
+ blacklist_type = "BLACKLISTED_INTERNET_NAME"
elif eventName == "AFFILIATE_INTERNET_NAME":
- e = "MALICIOUS_AFFILIATE_INTERNET_NAME"
+ malicious_type = "MALICIOUS_AFFILIATE_INTERNET_NAME"
+ blacklist_type = "BLACKLISTED_AFFILIATE_INTERNET_NAME"
elif eventName == "CO_HOSTED_SITE":
- e = "MALICIOUS_COHOST"
+ malicious_type = "MALICIOUS_COHOST"
+ blacklist_type = "BACKLISTED_COHOST"
else:
self.debug(f"Unexpected event type {eventName}, skipping")
@@ -123,8 +129,14 @@ class sfp_opendns(SpiderFootPlugin):
for result in res:
k = str(result)
- if k in self.checks:
- evt = SpiderFootEvent(e, f"{self.checks[k]} [{eventData}]", self.__name__, event)
+ if k not in self.checks:
+ continue
+
+ evt = SpiderFootEvent(blacklist_type, f"{self.checks[k]} [{eventData}]", self.__name__, event)
+ self.notifyListeners(evt)
+
+ if k in ['146.112.61.105', '146.112.61.107', '146.112.61.108', '146.112.61.110']:
+ evt = SpiderFootEvent(malicious_type, f"{self.checks[k]} [{eventData}]", self.__name__, event)
self.notifyListeners(evt)
# End of sfp_opendns class
diff --git a/test/unit/modules/test_sfp_opendns.py b/test/unit/modules/test_sfp_opendns.py
index 9c8974aa..7ab01867 100644
--- a/test/unit/modules/test_sfp_opendns.py
+++ b/test/unit/modules/test_sfp_opendns.py
@@ -78,7 +78,7 @@ class TestModuleopendns(unittest.TestCase):
module.setTarget(target)
def new_notifyListeners(self, event):
- expected = 'MALICIOUS_INTERNET_NAME'
+ expected = 'BLACKLISTED_INTERNET_NAME'
if str(event.eventType) != expected:
raise Exception(f"{event.eventType} != {expected}")