Skip to content

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

Reduce false positive e-mails.

smicallef1370ba552e67
diff --git a/modules/sfp_email.py b/modules/sfp_email.py
index b8d5a2e8..05914991 100644
--- a/modules/sfp_email.py
+++ b/modules/sfp_email.py
@@ -67,6 +67,10 @@ class sfp_email(SpiderFootPlugin):
# Get the domain and strip potential ending .
mailDom = email.lower().split('@')[1].strip('.')
+ if not self.sf.validHost(mailDom, self.opts['_internettlds']):
+ self.sf.debug("Skipping " + email + " as not a valid e-mail.")
+ return None
+
if not self.getTarget().matches(mailDom, includeChildren=True, includeParents=True) and not self.getTarget().matches(email):
self.sf.debug("External domain, so possible affiliate e-mail")
evttype = "AFFILIATE_EMAILADDR"
diff --git a/sflib.py b/sflib.py
index e2ec3efa..e78aaa67 100644
--- a/sflib.py
+++ b/sflib.py
@@ -779,6 +779,12 @@ class SpiderFoot:
suffix = ps.get_public_suffix(hostname)
return hostname == suffix
+ # Is the host a valid host (some filenames look like hosts)
+ def validHost(self, hostname, tldList):
+ ps = PublicSuffixList(tldList)
+ sfx = ps.get_public_suffix(hostname, strict=True)
+ return sfx != None
+
# Simple way to verify IPv4 addresses.
def validIP(self, address):
return netaddr.valid_ipv4(address)
@@ -2075,7 +2081,7 @@ class PublicSuffixList(object):
if child is not None:
self._lookup_node(matches, depth + 1, child, parts)
- def get_public_suffix(self, domain):
+ def get_public_suffix(self, domain, strict=False):
"""get_public_suffix("www.example.com") -> "example.com"
Calling this function with a DNS name will return the
@@ -2089,6 +2095,9 @@ class PublicSuffixList(object):
parts = domain.lower().lstrip('.').split('.')
hits = [None] * len(parts)
+ if strict and parts[-1] not in self.root[1]:
+ return None
+
self._lookup_node(hits, 1, self.root, parts)
for i, what in enumerate(hits):