SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Reduce e-mail false positives.
smicallef604097d8e924
diff --git a/modules/sfp_email.py b/modules/sfp_email.pyindex cd487cdd..05914991 100644--- a/modules/sfp_email.py+++ b/modules/sfp_email.py@@ -33,7 +33,7 @@ class sfp_email(SpiderFootPlugin):def setup(self, sfc, userOpts=dict()):self.sf = sfc- for opt in list(userOpts.keys()):+ for opt in userOpts.keys():self.opts[opt] = userOpts[opt]# What events is this module interested in for input@@ -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"@@ -76,7 +80,7 @@ class sfp_email(SpiderFootPlugin):self.sf.info("Found e-mail address: " + email)if type(email) == str:- mail = str(email.strip('.'), 'utf-8', errors='replace')+ mail = unicode(email.strip('.'), 'utf-8', errors='replace')else:mail = email.strip('.')diff --git a/sflib.py b/sflib.pyindex edd96b46..242a03fc 100644--- a/sflib.py+++ b/sflib.py@@ -766,6 +766,12 @@ class SpiderFoot:ps = PublicSuffixList(tldList)return ps.get_public_suffix(hostname)+ # 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+# Given a possible hostname, check if it's a domain name# By checking whether it rests atop a TLD.# e.g. www.example.com = False because tld of hostname is com,@@ -2080,7 +2086,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@@ -2094,6 +2100,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):