Skip to content

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

sfp_neutrinoapi: Support IPv6; Report blocked hosts as blacklisted (#1529)

bcoles3b2602159a91
diff --git a/modules/sfp_neutrinoapi.py b/modules/sfp_neutrinoapi.py
index e5ef5112..0385dd4c 100644
--- a/modules/sfp_neutrinoapi.py
+++ b/modules/sfp_neutrinoapi.py
@@ -20,7 +20,7 @@ class sfp_neutrinoapi(SpiderFootPlugin):
meta = {
'name': "NeutrinoAPI",
- 'summary': "Search NeutrinoAPI for IP address info and check IP reputation.",
+ 'summary': "Search NeutrinoAPI for phone location information, IP address information, and host reputation.",
'flags': ["apikey"],
'useCases': ["Footprint", "Investigate", "Passive"],
'categories': ["Reputation Systems"],
@@ -28,7 +28,11 @@ class sfp_neutrinoapi(SpiderFootPlugin):
'website': "https://www.neutrinoapi.com/",
'model': "FREE_AUTH_LIMITED",
'references': [
- "https://www.neutrinoapi.com/api/phone-validate/"
+ "https://www.neutrinoapi.com/api/api-basics/",
+ "https://www.neutrinoapi.com/api/phone-validate/",
+ "https://www.neutrinoapi.com/api/ip-info/",
+ "https://www.neutrinoapi.com/api/ip-blocklist/",
+ "https://www.neutrinoapi.com/api/host-reputation/",
],
'apiKeyInstructions': [
"Visit https://www.neutrinoapi.com/",
@@ -36,12 +40,9 @@ class sfp_neutrinoapi(SpiderFootPlugin):
"Click on 'My Account'",
"The API key is listed under 'Master Key'"
],
- 'favIcon': "https://www.google.com/s2/favicons?domain=https://www.neutrinoapi.com/",
- 'logo': "https://www.google.com/s2/favicons?domain=https://www.neutrinoapi.com/",
- 'description': "Parse, validate and get location information about a phone number.\n"
- "Use this API to validate local and international phone numbers in any country. "
- "You can determine the location of the number and also reformat the number into "
- "local and international dialing formats.",
+ 'favIcon': "https://www.neutrinoapi.com/favicon.png",
+ 'logo': "https://www.neutrinoapi.com/favicon.png",
+ 'description': "Neutrino API - The general-purpose API - Build smarter applications."
}
}
@@ -74,11 +75,19 @@ class sfp_neutrinoapi(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ['IP_ADDRESS', 'PHONE_NUMBER']
+ return ['IP_ADDRESS', 'IPV6_ADDRESS', 'PHONE_NUMBER']
# What events this module produces
def producedEvents(self):
- return ['RAW_RIR_DATA', 'MALICIOUS_IPADDR', 'GEOINFO']
+ return [
+ 'RAW_RIR_DATA',
+ 'BLACKLISTED_IPADDR',
+ 'MALICIOUS_IPADDR',
+ 'PROXY_HOST',
+ 'VPN_HOST',
+ 'TOR_EXIT_NODE',
+ 'GEOINFO',
+ ]
# Query the phone-validate REST API
# https://www.neutrinoapi.com/api/phone-validate/
@@ -109,7 +118,7 @@ class sfp_neutrinoapi(SpiderFootPlugin):
def queryIpBlocklist(self, qry):
res = self.sf.fetchUrl(
"https://neutrinoapi.com/ip-blocklist",
- postData={"output-format": "json", "ip": qry, "user-id": self.opts['user_id'], "api-key": self.opts['api_key']},
+ postData={"output-format": "json", "ip": qry, "vpn-lookup": True, "user-id": self.opts['user_id'], "api-key": self.opts['api_key']},
timeout=self.opts['timeout'],
useragent=self.opts['_useragent']
)
@@ -156,17 +165,14 @@ class sfp_neutrinoapi(SpiderFootPlugin):
return data
- # Handle events sent to this module
def handleEvent(self, event):
eventName = event.eventType
- srcModuleName = event.module
eventData = event.data
if self.errorState:
return
- if eventData in self.results:
- return
+ self.debug(f"Received event, {eventName}, from {event.module}")
if self.opts['api_key'] == "":
self.error("You enabled sfp_neutrinoapi but did not set an API key!")
@@ -178,9 +184,10 @@ class sfp_neutrinoapi(SpiderFootPlugin):
self.errorState = True
return
- self.results[eventData] = True
+ if eventData in self.results:
+ return
- self.debug(f"Received event, {eventName}, from {srcModuleName}")
+ self.results[eventData] = True
if eventName == 'PHONE_NUMBER':
data = self.queryPhoneValidate(eventData)
@@ -199,7 +206,7 @@ class sfp_neutrinoapi(SpiderFootPlugin):
evt = SpiderFootEvent("RAW_RIR_DATA", str(data), self.__name__, event)
self.notifyListeners(evt)
- if eventName == 'IP_ADDRESS':
+ if eventName in ['IP_ADDRESS', 'IPV6_ADDRESS']:
data = self.queryIpInfo(eventData)
if data is None:
@@ -216,18 +223,34 @@ class sfp_neutrinoapi(SpiderFootPlugin):
self.debug("No IP blocklist results found for " + eventData)
else:
if data.get('is-listed'):
- evt = SpiderFootEvent("MALICIOUS_IPADDR", "NeutrinoAPI [" + eventData + "]", self.__name__, event)
+ evt = SpiderFootEvent("MALICIOUS_IPADDR", f"NeutrinoAPI - IP Blocklist [{eventData}]", self.__name__, event)
+ self.notifyListeners(evt)
+ evt = SpiderFootEvent("BLACKLISTED_IPADDR", f"NeutrinoAPI - IP Blocklist [{eventData}]", self.__name__, event)
self.notifyListeners(evt)
evt = SpiderFootEvent("RAW_RIR_DATA", str(data), self.__name__, event)
self.notifyListeners(evt)
+ if data.get('is-proxy'):
+ evt = SpiderFootEvent("PROXY_HOST", eventData, self.__name__, event)
+ self.notifyListeners(evt)
+
+ if data.get('is-vpn'):
+ evt = SpiderFootEvent("VPN_HOST", eventData, self.__name__, event)
+ self.notifyListeners(evt)
+
+ if data.get('is-tor'):
+ evt = SpiderFootEvent("TOR_EXIT_NODE", eventData, self.__name__, event)
+ self.notifyListeners(evt)
+
data = self.queryHostReputation(eventData)
if data is None:
self.debug("No host reputation results found for " + eventData)
else:
if data.get('is-listed'):
- evt = SpiderFootEvent("MALICIOUS_IPADDR", "NeutrinoAPI [" + eventData + "]", self.__name__, event)
+ evt = SpiderFootEvent("MALICIOUS_IPADDR", f"NeutrinoAPI - Host Reputation [{eventData}]", self.__name__, event)
+ self.notifyListeners(evt)
+ evt = SpiderFootEvent("BLACKLISTED_IPADDR", f"NeutrinoAPI - Host Reputation [{eventData}]", self.__name__, event)
self.notifyListeners(evt)
evt = SpiderFootEvent("RAW_RIR_DATA", str(data), self.__name__, event)
self.notifyListeners(evt)