Skip to content

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

sfp_yandexdns: Report blocked hosts as blacklisted (#1503)

bcoles3c8ee5402791
diff --git a/modules/sfp_yandexdns.py b/modules/sfp_yandexdns.py
index 750ca399..b371e583 100644
--- a/modules/sfp_yandexdns.py
+++ b/modules/sfp_yandexdns.py
@@ -41,11 +41,9 @@ class sfp_yandexdns(SpiderFootPlugin):
}
}
- # Default options
opts = {
}
- # Option descriptions
optdescs = {
}
@@ -72,9 +70,12 @@ class sfp_yandexdns(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",
]
# Query Yandex DNS "family" servers
@@ -92,7 +93,6 @@ class sfp_yandexdns(SpiderFootPlugin):
return None
- # Handle events sent to this module
def handleEvent(self, event):
eventName = event.eventType
eventData = event.data
@@ -105,11 +105,14 @@ class sfp_yandexdns(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")
@@ -122,8 +125,14 @@ class sfp_yandexdns(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 == '213.180.193.250':
+ evt = SpiderFootEvent(malicious_type, f"{self.checks[k]} [{eventData}]", self.__name__, event)
self.notifyListeners(evt)
# End of sfp_yandexdns class
diff --git a/test/unit/modules/test_sfp_yandexdns.py b/test/unit/modules/test_sfp_yandexdns.py
index 7ce8377f..32588aa1 100644
--- a/test/unit/modules/test_sfp_yandexdns.py
+++ b/test/unit/modules/test_sfp_yandexdns.py
@@ -78,7 +78,7 @@ class TestModuleyandexdns(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}")