Skip to content

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

modules: Report AFFILIATE_IPADDR for NETBLOCK_MEMBER; IP_ADDRESS for NETBLOCK_OWNER (#1415)

bcoles77fd96c9b9f8
diff --git a/modules/sfp_alienvault.py b/modules/sfp_alienvault.py
index 9e9ce4d9..e51431d2 100644
--- a/modules/sfp_alienvault.py
+++ b/modules/sfp_alienvault.py
@@ -122,6 +122,8 @@ class sfp_alienvault(SpiderFootPlugin):
# What events this module produces
def producedEvents(self):
return [
+ "IP_ADDRESS",
+ "AFFILIATE_IPADDR",
"CO_HOSTED_SITE",
"INTERNET_NAME",
"INTERNET_NAME_UNRESOLVED",
@@ -373,20 +375,20 @@ class sfp_alienvault(SpiderFootPlugin):
else:
self.sf.info(f"Maximum co-host threshold exceeded ({self.opts['maxcohost']}), ignoring co-host {host}")
+ if eventName in ['IP_ADDRESS', 'IPV6_ADDRESS'] or eventName.startswith('NETBLOCK_'):
+ evtType = 'MALICIOUS_IPADDR'
+ elif eventName == "AFFILIATE_IPADDR":
+ evtType = 'MALICIOUS_AFFILIATE_IPADDR'
+ else:
+ self.sf.debug(f"Unexpected event type {eventName}, skipping")
+ return
+
for addr in qrylist:
if self.checkForStop():
return
if self.errorState:
return
- if eventName in ['IP_ADDRESS', 'IPV6_ADDRESS'] or eventName.startswith('NETBLOCK_'):
- evtType = 'MALICIOUS_IPADDR'
- elif eventName == "AFFILIATE_IPADDR":
- evtType = 'MALICIOUS_AFFILIATE_IPADDR'
- else:
- self.sf.debug(f"Unexpected event type {eventName}, skipping")
- continue
-
rec = self.queryReputation(addr)
if not rec:
@@ -426,9 +428,12 @@ class sfp_alienvault(SpiderFootPlugin):
# For netblocks, we need to create the IP address event so that
# the threat intel event is more meaningful.
- if eventName.startswith('NETBLOCK_'):
+ if eventName == 'NETBLOCK_OWNER':
pevent = SpiderFootEvent("IP_ADDRESS", addr, self.__name__, event)
self.notifyListeners(pevent)
+ elif eventName == 'NETBLOCK_MEMBER':
+ pevent = SpiderFootEvent("AFFILIATE_IPADDR", addr, self.__name__, event)
+ self.notifyListeners(pevent)
else:
pevent = event
e = SpiderFootEvent(evtType, descr, self.__name__, pevent)
diff --git a/modules/sfp_censys.py b/modules/sfp_censys.py
index 894a979b..b54b49ef 100644
--- a/modules/sfp_censys.py
+++ b/modules/sfp_censys.py
@@ -199,7 +199,7 @@ class sfp_censys(SpiderFootPlugin):
# For netblocks, we need to create the IP address event so that
# the threat intel event is more meaningful.
- if eventName.startswith('NETBLOCK_'):
+ if eventName == 'NETBLOCK_OWNER':
pevent = SpiderFootEvent("IP_ADDRESS", addr, self.__name__, event)
self.notifyListeners(pevent)
else:
diff --git a/modules/sfp_fraudguard.py b/modules/sfp_fraudguard.py
index 4e1ef7ec..7471865a 100644
--- a/modules/sfp_fraudguard.py
+++ b/modules/sfp_fraudguard.py
@@ -185,7 +185,7 @@ class sfp_fraudguard(SpiderFootPlugin):
# For netblocks, we need to create the IP address event so that
# the threat intel event is more meaningful.
- if eventName.startswith('NETBLOCK_'):
+ if eventName == 'NETBLOCK_OWNER':
pevent = SpiderFootEvent("IP_ADDRESS", addr, self.__name__, event)
self.notifyListeners(pevent)
else:
diff --git a/modules/sfp_hackertarget.py b/modules/sfp_hackertarget.py
index 2e6dee00..6ff9d86e 100644
--- a/modules/sfp_hackertarget.py
+++ b/modules/sfp_hackertarget.py
@@ -419,7 +419,7 @@ class sfp_hackertarget(SpiderFootPlugin):
# For netblocks, we need to create the IP address event so that
# the threat intel event is more meaningful.
- if eventName.startswith('NETBLOCK_'):
+ if eventName == 'NETBLOCK_OWNER':
pevent = SpiderFootEvent("IP_ADDRESS", ip, self.__name__, event)
self.notifyListeners(pevent)
else:
diff --git a/modules/sfp_shodan.py b/modules/sfp_shodan.py
index 18ca0c49..86f8c009 100644
--- a/modules/sfp_shodan.py
+++ b/modules/sfp_shodan.py
@@ -242,7 +242,7 @@ class sfp_shodan(SpiderFootPlugin):
# For netblocks, we need to create the IP address event so that
# the threat intel event is more meaningful.
- if eventName.startswith('NETBLOCK_'):
+ if eventName == 'NETBLOCK_OWNER':
pevent = SpiderFootEvent("IP_ADDRESS", addr, self.__name__, event)
self.notifyListeners(pevent)
else:
diff --git a/modules/sfp_template.py b/modules/sfp_template.py
index d223397b..ba67348e 100644
--- a/modules/sfp_template.py
+++ b/modules/sfp_template.py
@@ -315,7 +315,7 @@ class sfp_template(SpiderFootPlugin):
# For netblocks, we need to create the IP address event so that
# the threat intel event is more meaningful and linked to the
# IP address within the network, not the whole network.
- if eventName.startswith('NETBLOCK_'):
+ if eventName == 'NETBLOCK_OWNER':
# This is where the module generates an event for other modules
# to process and is a fundamental part of the SpiderFoot architecture.
# We are generating an event of type "IP_ADDRESS" here, the data being
@@ -329,6 +329,9 @@ class sfp_template(SpiderFootPlugin):
# for IP_ADDRESS events (which they define in their watchedEvents()
# function).
self.notifyListeners(pevent)
+ elif eventName == 'NETBLOCK_MEMBER':
+ pevent = SpiderFootEvent("AFFILIATE_IPADDR", addr, self.__name__, event)
+ self.notifyListeners(pevent)
else:
# If the event received wasn't a netblock, then use that event
# as the source event for later events.