Skip to content

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

Use getTarget() includeChildren=True, includeParents=True for emails

Brendan Coles459f3e0430e7
diff --git a/modules/sfp_email.py b/modules/sfp_email.py
index c8f8a958..dc5adea3 100644
--- a/modules/sfp_email.py
+++ b/modules/sfp_email.py
@@ -66,7 +66,7 @@ class sfp_email(SpiderFootPlugin):
# Get the domain and strip potential ending .
mailDom = email.lower().split('@')[1].strip('.')
- if not self.getTarget().matches(mailDom) and not self.getTarget().matches(match):
+ if not self.getTarget().matches(mailDom, includeChildren=True, includeParents=True) and not self.getTarget().matches(match):
self.sf.debug("External domain, so possible affiliate e-mail")
evttype = "AFFILIATE_EMAILADDR"
diff --git a/modules/sfp_emailformat.py b/modules/sfp_emailformat.py
index 7f0ec41a..76dc8caf 100644
--- a/modules/sfp_emailformat.py
+++ b/modules/sfp_emailformat.py
@@ -31,7 +31,6 @@ class sfp_emailformat(SpiderFootPlugin):
def setup(self, sfc, userOpts=dict()):
self.sf = sfc
- self.__dataSource__ = "Email-Format.com"
self.results = self.tempStorage()
for opt in userOpts.keys():
@@ -39,7 +38,7 @@ class sfp_emailformat(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["DOMAIN_NAME"]
+ return ['INTERNET_NAME', "DOMAIN_NAME"]
# What events this module produces
# This is to support the end user in selecting modules based on events
@@ -73,7 +72,7 @@ class sfp_emailformat(SpiderFootPlugin):
# Skip unrelated emails
mailDom = email.lower().split('@')[1]
- if not self.getTarget().matches(mailDom):
+ if not self.getTarget().matches(mailDom, includeChildren=True, includeParents=True):
self.sf.debug("Skipped address: " + email)
continue
diff --git a/modules/sfp_flickr.py b/modules/sfp_flickr.py
index bd99257e..294d5e9d 100644
--- a/modules/sfp_flickr.py
+++ b/modules/sfp_flickr.py
@@ -38,7 +38,6 @@ class sfp_flickr(SpiderFootPlugin):
def setup(self, sfc, userOpts=dict()):
self.sf = sfc
- self.__dataSource__ = "Flickr"
self.results = self.tempStorage()
for opt in userOpts.keys():
@@ -46,7 +45,7 @@ class sfp_flickr(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["DOMAIN_NAME"]
+ return ['INTERNET_NAME', "DOMAIN_NAME"]
# What events this module produces
def producedEvents(self):
@@ -146,31 +145,19 @@ class sfp_flickr(SpiderFootPlugin):
# Extract emails
for photo in data['photos']['photo']:
- matches = re.findall(r'([a-zA-Z\.0-9_\-]+@[a-zA-Z\.0-9\-]+\.[a-zA-Z\.0-9\-]+)', str(photo).decode('unicode-escape'))
- for match in matches:
- self.sf.debug("Found possible email: " + match)
-
- # Handle false positive matches
- if len(match) < 5:
- self.sf.debug("Likely invalid address.")
- continue
-
- # Handle messed up encodings
- if "%" in match:
- self.sf.debug("Skipped address: " + match)
- continue
-
+ emails = self.sf.parseEmails(str(photo).decode('unicode-escape'))
+ for email in emails:
# Skip unrelated emails
- mailDom = match.lower().split('@')[1]
- if not self.getTarget().matches(mailDom):
- self.sf.debug("Skipped address: " + match)
+ mailDom = email.lower().split('@')[1]
+ if not self.getTarget().matches(mailDom, includeChildren=True, includeParents=True):
+ self.sf.debug("Skipped address: " + email)
continue
- if match not in self.results:
- self.sf.info("Found e-mail address: " + match)
- evt = SpiderFootEvent("EMAILADDR", match, self.__name__, event)
+ if email not in self.results:
+ self.sf.info("Found e-mail address: " + email)
+ evt = SpiderFootEvent("EMAILADDR", email, self.__name__, event)
self.notifyListeners(evt)
- self.results[match] = True
+ self.results[email] = True
page += 1
time.sleep(self.opts['pause'])
diff --git a/modules/sfp_pgp.py b/modules/sfp_pgp.py
index cdb29cd0..1f6a1ad5 100644
--- a/modules/sfp_pgp.py
+++ b/modules/sfp_pgp.py
@@ -48,7 +48,7 @@ class sfp_pgp(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["EMAILADDR", "DOMAIN_NAME"]
+ return ['INTERNET_NAME', "EMAILADDR", "DOMAIN_NAME"]
# What events this module produces
# This is to support the end user in selecting modules based on events
@@ -86,7 +86,7 @@ class sfp_pgp(SpiderFootPlugin):
evttype = "EMAILADDR"
mailDom = email.lower().split('@')[1]
- if not self.getTarget().matches(mailDom):
+ if not self.getTarget().matches(mailDom, includeChildren=True, includeParents=True):
evttype = "AFFILIATE_EMAILADDR"
self.sf.info("Found e-mail address: " + email)
diff --git a/modules/sfp_skymem.py b/modules/sfp_skymem.py
index 97afb0e4..b4bc6f83 100644
--- a/modules/sfp_skymem.py
+++ b/modules/sfp_skymem.py
@@ -38,7 +38,7 @@ class sfp_skymem(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["DOMAIN_NAME"]
+ return ['INTERNET_NAME', "DOMAIN_NAME"]
# What events this module produces
# This is to support the end user in selecting modules based on events
@@ -71,7 +71,7 @@ class sfp_skymem(SpiderFootPlugin):
for email in emails:
# Skip unrelated emails
mailDom = email.lower().split('@')[1]
- if not self.getTarget().matches(mailDom):
+ if not self.getTarget().matches(mailDom, includeChildren=True, includeParents=True):
self.sf.debug("Skipped address: " + email)
continue
@@ -99,7 +99,7 @@ class sfp_skymem(SpiderFootPlugin):
for email in emails:
# Skip unrelated emails
mailDom = email.lower().split('@')[1]
- if not self.getTarget().matches(mailDom):
+ if not self.getTarget().matches(mailDom, includeChildren=True, includeParents=True):
self.sf.debug("Skipped address: " + email)
continue