Skip to content

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

Bug fixes and tweaks.

Steve Micallefb274048c2d5a
diff --git a/modules/sfp_alienvault.py b/modules/sfp_alienvault.py
index 321678bb..18741d55 100644
--- a/modules/sfp_alienvault.py
+++ b/modules/sfp_alienvault.py
@@ -61,16 +61,12 @@ class sfp_alienvault(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["IP_ADDRESS", "AFFILIATE_IPADDR", "INTERNET_NAME",
- "CO_HOSTED_SITE", "NETBLOCK_OWNER", "NETBLOCK_MEMBER",
- "AFFILIATE_INTERNET_NAME", "IPV6_ADDRESS"]
+ return ["IP_ADDRESS", "AFFILIATE_IPADDR",
+ "NETBLOCK_OWNER", "NETBLOCK_MEMBER"]
# What events this module produces
def producedEvents(self):
- return ["MALICIOUS_IPADDR", "MALICIOUS_INTERNET_NAME",
- "MALICIOUS_COHOST", "MALICIOUS_AFFILIATE_INTERNET_NAME",
- "MALICIOUS_AFFILIATE_IPADDR", "MALICIOUS_NETBLOCK",
- "CO_HOSTED_SITE"]
+ return ["MALICIOUS_IPADDR", "MALICIOUS_AFFILIATE_IPADDR", "MALICIOUS_NETBLOCK" ]
def query(self, qry, querytype):
ret = None
@@ -106,6 +102,7 @@ class sfp_alienvault(SpiderFootPlugin):
try:
info = json.loads(res['content'])
except Exception as e:
+ print str(res['content'])
self.sf.error("Error processing JSON response from AlienVault OTX.", False)
return None
@@ -196,12 +193,6 @@ class sfp_alienvault(SpiderFootPlugin):
evtType = 'MALICIOUS_IPADDR'
if eventName == "AFFILIATE_IPADDR":
evtType = 'MALICIOUS_AFFILIATE_IPADDR'
- if eventName == "INTERNET_NAME":
- evtType = "MALICIOUS_INTERNET_NAME"
- if eventName == 'AFFILIATE_INTERNET_NAME':
- evtType = 'MALICIOUS_AFFILIATE_INTERNET_NAME'
- if eventName == 'CO_HOSTED_SITE':
- evtType = 'MALICIOUS_COHOST'
rec = self.query(addr, "reputation")
if rec is not None:
diff --git a/modules/sfp_digitaloceanspace.py b/modules/sfp_digitaloceanspace.py
index 8df46529..aa6a6831 100644
--- a/modules/sfp_digitaloceanspace.py
+++ b/modules/sfp_digitaloceanspace.py
@@ -54,11 +54,11 @@ class sfp_digitaloceanspace(SpiderFootPlugin):
return ["CLOUD_STORAGE_BUCKET", "CLOUD_STORAGE_BUCKET_OPEN"]
def checkSite(self, url):
- res = self.sf.fetchUrl(url, timeout=10, useragent="SpiderFoot")
+ res = self.sf.fetchUrl(url, timeout=10, useragent="SpiderFoot", noLog=True)
if res['code'] not in [ "301", "302", "200" ] and \
(res['content'] is None or "NoSuchBucket" in res['content']):
- self.sf.debug("Not a valid bucket: " + url)
+ return None
else:
if "ListBucketResult" in res['content']:
self.s3results[url] = res['content'].count("<Key>")
diff --git a/modules/sfp_dnscommonsrv.py b/modules/sfp_dnscommonsrv.py
index 0ec930b7..b7c058af 100644
--- a/modules/sfp_dnscommonsrv.py
+++ b/modules/sfp_dnscommonsrv.py
@@ -78,7 +78,7 @@ class sfp_dnscommonsrv(SpiderFootPlugin):
# This is to support the end user in selecting modules based on events
# produced.
def producedEvents(self):
- return ["IP_ADDRESS", "INTERNET_NAME", "IPV6_ADDRESS"]
+ return ["INTERNET_NAME", "AFFILIATE_INTERNET_NAME"]
# Handle events sent to this module
def handleEvent(self, event):
@@ -109,7 +109,7 @@ class sfp_dnscommonsrv(SpiderFootPlugin):
name = srv + "." + eventData
# Skip hosts we've processed already
- if self.sf.hashstring(name) in self.events.keys():
+ if self.sf.hashstring(name) in self.events:
continue
try:
@@ -121,9 +121,14 @@ class sfp_dnscommonsrv(SpiderFootPlugin):
# Strip off the trailing .
tgt_clean = a.target.to_text().rstrip(".")
# Report the host
- evt = SpiderFootEvent("INTERNET_NAME", tgt_clean,
- self.__name__, parentEvent)
- self.notifyListeners(evt)
+ if self.getTarget().matches(tgt_clean):
+ evt = SpiderFootEvent("INTERNET_NAME", tgt_clean,
+ self.__name__, parentEvent)
+ self.notifyListeners(evt)
+ else:
+ evt = SpiderFootEvent("AFFILIATE_INTERNET_NAME", tgt_clean,
+ self.__name__, parentEvent)
+ self.notifyListeners(evt)
evt = SpiderFootEvent("DNS_SRV", name,
self.__name__, parentEvent)
diff --git a/modules/sfp_s3bucket.py b/modules/sfp_s3bucket.py
index d4d5953b..d29c563a 100644
--- a/modules/sfp_s3bucket.py
+++ b/modules/sfp_s3bucket.py
@@ -54,11 +54,12 @@ class sfp_s3bucket(SpiderFootPlugin):
return ["CLOUD_STORAGE_BUCKET", "CLOUD_STORAGE_BUCKET_OPEN"]
def checkSite(self, url):
- res = self.sf.fetchUrl(url, timeout=10, useragent="SpiderFoot")
+ res = self.sf.fetchUrl(url, timeout=10, useragent="SpiderFoot", noLog=True)
if res['code'] not in [ "301", "302", "200" ] and \
(res['content'] is None or "NoSuchBucket" in res['content']):
- self.sf.debug("Not a valid bucket: " + url)
+ #self.sf.debug("Not a valid bucket: " + url)
+ return None
else:
if "ListBucketResult" in res['content']:
self.s3results[url] = res['content'].count("<Key>")
diff --git a/modules/sfp_similar.py b/modules/sfp_similar.py
index b1aca83d..507152de 100644
--- a/modules/sfp_similar.py
+++ b/modules/sfp_similar.py
@@ -85,7 +85,7 @@ class sfp_similar(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["DOMAIN_NAME", "INTERNET_NAME"]
+ return ["DOMAIN_NAME"]
# What events this module produces
# This is to support the end user in selecting modules based on events
diff --git a/modules/sfp_sublist3r.py b/modules/sfp_sublist3r.py
index 00c81961..54e4c4ee 100644
--- a/modules/sfp_sublist3r.py
+++ b/modules/sfp_sublist3r.py
@@ -64,7 +64,7 @@ class sfp_sublist3r(SpiderFootPlugin):
# What events this module produces
def producedEvents(self):
- return ["INTERNET_NAME"]
+ return ["INTERNET_NAME", "INTERNET_NAME_UNRESOLVED"]
def query(self, qry):
url = "https://api.sublist3r.com/search.php?domain=" + qry
@@ -107,7 +107,10 @@ class sfp_sublist3r(SpiderFootPlugin):
for res in ret:
if self.opts['verify']:
if not self.resolveHost(res):
+ e = SpiderFootEvent("INTERNET_NAME_UNRESOLVED", res, self.__name__, event)
+ self.notifyListeners(e)
continue
+
e = SpiderFootEvent("INTERNET_NAME", res, self.__name__, event)
self.notifyListeners(e)
diff --git a/modules/sfp_virustotal.py b/modules/sfp_virustotal.py
index 91898218..dd74547f 100644
--- a/modules/sfp_virustotal.py
+++ b/modules/sfp_virustotal.py
@@ -12,6 +12,7 @@
import json
import time
+import socket
from netaddr import IPNetwork
from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
@@ -22,10 +23,11 @@ class sfp_virustotal(SpiderFootPlugin):
# Default options
opts = {
- "api_key": "",
- "publicapi": True,
- "checkcohosts": True,
- "checkaffiliates": True,
+ 'api_key': '',
+ 'verify': True,
+ 'publicapi': True,
+ 'checkcohosts': True,
+ 'checkaffiliates': True,
'netblocklookup': True,
'maxnetblock': 24,
'subnetlookup': True,
@@ -34,14 +36,15 @@ class sfp_virustotal(SpiderFootPlugin):
# Option descriptions
optdescs = {
- "api_key": "VirusTotal API Key.",
- "publicapi": "Are you using a public key? If so SpiderFoot will pause for 15 seconds after each query to avoid VirusTotal dropping requests.",
- "checkcohosts": "Check co-hosted sites?",
- "checkaffiliates": "Check affiliates?",
- 'netblocklookup': "Look up all IPs on netblocks deemed to be owned by your target for possible hosts on the same target subdomain/domain?",
- 'maxnetblock': "If looking up owned netblocks, the maximum netblock size to look up all IPs within (CIDR value, 24 = /24, 16 = /16, etc.)",
- 'subnetlookup': "Look up all IPs on subnets which your target is a part of?",
- 'maxsubnet': "If looking up subnets, the maximum subnet size to look up all the IPs within (CIDR value, 24 = /24, 16 = /16, etc.)"
+ 'api_key': 'VirusTotal API Key.',
+ 'publicapi': 'Are you using a public key? If so SpiderFoot will pause for 15 seconds after each query to avoid VirusTotal dropping requests.',
+ 'checkcohosts': 'Check co-hosted sites?',
+ 'checkaffiliates': 'Check affiliates?',
+ 'netblocklookup': 'Look up all IPs on netblocks deemed to be owned by your target for possible hosts on the same target subdomain/domain?',
+ 'maxnetblock': 'If looking up owned netblocks, the maximum netblock size to look up all IPs within (CIDR value, 24 = /24, 16 = /16, etc.)',
+ 'subnetlookup': 'Look up all IPs on subnets which your target is a part of?',
+ 'maxsubnet': 'If looking up subnets, the maximum subnet size to look up all the IPs within (CIDR value, 24 = /24, 16 = /16, etc.)',
+ 'verify': 'Verify that any hostnames found on the target domain still resolve?'
}
# Be sure to completely clear any class variables in setup()
@@ -71,7 +74,18 @@ class sfp_virustotal(SpiderFootPlugin):
return ["MALICIOUS_IPADDR", "MALICIOUS_INTERNET_NAME",
"MALICIOUS_COHOST", "MALICIOUS_AFFILIATE_INTERNET_NAME",
"MALICIOUS_AFFILIATE_IPADDR", "MALICIOUS_NETBLOCK",
- "MALICIOUS_SUBNET", "INTERNET_NAME", "AFFILIATE_INTERNET_NAME"]
+ "MALICIOUS_SUBNET", "INTERNET_NAME", "AFFILIATE_INTERNET_NAME",
+ "INTERNET_NAME_UNRESOLVED"]
+
+ # Verify a host resolves
+ def resolveHost(self, host):
+ try:
+ addrs = socket.gethostbyname_ex(host)
+ except BaseException as e:
+ self.sf.debug("Unable to resolve " + host + ": " + str(e))
+ return False
+
+ return True
def query(self, qry):
ret = None
@@ -201,8 +215,13 @@ class sfp_virustotal(SpiderFootPlugin):
for s in info['domain_siblings']:
if self.getTarget().matches(s):
if s not in self.results:
- e = SpiderFootEvent("INTERNET_NAME", s, self.__name__, event)
- self.notifyListeners(e)
+ if self.opts['verify']:
+ if not self.resolveHost(s):
+ e = SpiderFootEvent("INTERNET_NAME_UNRESOLVED", s, self.__name__, event)
+ self.notifyListeners(e)
+ else:
+ e = SpiderFootEvent("INTERNET_NAME", s, self.__name__, event)
+ self.notifyListeners(e)
else:
if s not in self.results:
e = SpiderFootEvent("AFFILIATE_INTERNET_NAME", s, self.__name__, event)
@@ -211,7 +230,12 @@ class sfp_virustotal(SpiderFootPlugin):
if 'subdomains' in info and eventName == "INTERNET_NAME":
for n in info['subdomains']:
if n not in self.results:
- e = SpiderFootEvent("INTERNET_NAME", n, self.__name__, event)
- self.notifyListeners(e)
+ if self.opts['verify']:
+ if not self.resolveHost(n):
+ e = SpiderFootEvent("INTERNET_NAME_UNRESOLVED", n, self.__name__, event)
+ self.notifyListeners(e)
+ else:
+ e = SpiderFootEvent("INTERNET_NAME", n, self.__name__, event)
+ self.notifyListeners(e)
# End of sfp_virustotal class