Skip to content

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

Bug fixes.

smicallef155fa30ad9fc
diff --git a/modules/sfp_dns.py b/modules/sfp_dns.py
index cd49dfd3..5dd43648 100644
--- a/modules/sfp_dns.py
+++ b/modules/sfp_dns.py
@@ -92,13 +92,14 @@ class sfp_dns(SpiderFootPlugin):
# a CNAME, or an IP is being reverse looked up
if len(addrs[0]) > 0:
host = addrs[0]
- sf.debug("Found possible URL: " + host)
- self.notifyListeners("URL", eventData, host)
+ sf.debug("Found host: " + host)
# If the returned hostname is on a different
# domain to baseDomain, flag it as an affiliate
if not host.endswith(self.baseDomain):
self.notifyListeners("AFFILIATE", eventData, host)
+ else:
+ self.notifyListeners("SUBDOMAIN", eventData, host)
# In tests addr[1] was either always the requested lookup or empty
diff --git a/modules/sfp_googlesearch.py b/modules/sfp_googlesearch.py
index 81601abc..6822db5d 100644
--- a/modules/sfp_googlesearch.py
+++ b/modules/sfp_googlesearch.py
@@ -71,6 +71,7 @@ class sfp_googlesearch(SpiderFootPlugin):
if self.checkForStop():
return None
+ # Submit the google results for analysis
self.notifyListeners("WEBCONTENT", page, pages[page])
self.results.append(page)
@@ -92,8 +93,12 @@ class sfp_googlesearch(SpiderFootPlugin):
if self.checkForStop():
return None
linkPage = sf.fetchUrl(link)
- self.notifyListeners("URL", page, link)
+
+ # Submit info from what we've fetched for analysis
+ self.notifyListeners("URL_INTERNAL", page, link)
self.notifyListeners("WEBCONTENT", link, linkPage['content'])
+ self.notifyListeners("HTTP_CODE", link, linkPage['code'])
+ self.notifyListeners("WEBSERVER_HTTPHEADERS", link, linkPage['headers'])
self.results.append(link)
# End of sfp_googlesearch class
diff --git a/modules/sfp_mail.py b/modules/sfp_mail.py
index ee2b1dfc..d8ae8edb 100644
--- a/modules/sfp_mail.py
+++ b/modules/sfp_mail.py
@@ -67,7 +67,15 @@ class sfp_mail(SpiderFootPlugin):
matches = re.findall("([a-zA-Z\.0-9_\-]+@[a-zA-Z\.0-9_\-]+)", eventData)
for match in matches:
- sf.debug("Found email: " + match)
+ sf.debug("Found possible email: " + match)
+
+ if len(match) < 4:
+ sf.debug("Likely invalid address.")
+ continue
+
+ if self.baseDomain not in match:
+ sf.debug("E-mail (or something) from somewhere else..")
+ continue
if self.results.has_key(match):
sf.debug("Already found, skipping.")
diff --git a/modules/sfp_spider.py b/modules/sfp_spider.py
index 2705ea2b..4bf0c6f2 100644
--- a/modules/sfp_spider.py
+++ b/modules/sfp_spider.py
@@ -28,7 +28,7 @@ class sfp_spider(SpiderFootPlugin):
'__debugfilter': '',
# options specific to this module
'robotsonly': False, # only follow links specified by robots.txt
- 'pause': 0, # number of seconds to pause between fetches
+ 'pause': 1, # number of seconds to pause between fetches
'maxpages': 10000, # max number of pages to fetch
'maxlevels': 10, # max number of levels to traverse within a site
'filterfiles': ['png','gif','jpg','jpeg','tiff', 'tif', 'js', 'css',
@@ -108,7 +108,10 @@ class sfp_spider(SpiderFootPlugin):
if source != None:
self.results[url]['source'] = source
- self.notifyListeners("URL", source, url)
+ if self.baseDomain + "/" in url:
+ self.notifyListeners("URL_INTERNAL", source, url)
+ else:
+ self.notifyListeners("URL_EXTERNAL", source, url)
stored += 's'
if original != None:
diff --git a/modules/sfp_stor_db.py b/modules/sfp_stor_db.py
index b0f274c6..421543d7 100644
--- a/modules/sfp_stor_db.py
+++ b/modules/sfp_stor_db.py
@@ -58,7 +58,8 @@ class sfp_stor_db(SpiderFootPlugin):
# Handle events sent to this module
def handleEvent(self, srcModuleName, eventName, eventSource, eventData):
- print "OPT: " + str(self.opts['maxstorage'])
+ # Convert to a string in case we get passed integers or other things
+ eventData = str(eventData)
if self.opts['maxstorage'] != 0 and len(eventData) > self.opts['maxstorage']:
sfdb.scanEventStore(self.opts['__guid__'], eventName, eventSource,
eventData[0:self.opts['maxstorage']], srcModuleName)
diff --git a/modules/sfp_subdomain.py b/modules/sfp_subdomain.py
index 9a7d74b2..096eae48 100644
--- a/modules/sfp_subdomain.py
+++ b/modules/sfp_subdomain.py
@@ -48,7 +48,7 @@ class sfp_subdomain(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ["WEBCONTENT", "URL"]
+ return ["WEBCONTENT", "URL_INTERNAL"]
# Handle events sent to this module
def handleEvent(self, srcModuleName, eventName, eventSource, eventData):
diff --git a/modules/sfp_xref.py b/modules/sfp_xref.py
index 657bf86a..3ad11d83 100644
--- a/modules/sfp_xref.py
+++ b/modules/sfp_xref.py
@@ -29,14 +29,17 @@ class sfp_xref(SpiderFootPlugin):
'__debugfilter': '',
'forcebase': True, # Check the base URL for a link back to the seed
# domain in order to be considered a valid xref
- 'checkbase': True # Only check the base URL for a relationship if
+ 'checkbase': True, # Only check the base URL for a relationship if
# the link provided contains no xref
+ 'checkcontent': True # Submit affiliate content for other modules to
+ # analyze
}
# Option descriptions
optdescs = {
"forcebase": "Require the base domain of an external URL for affiliation?",
- "checkbase": "Check the base domain of a URL for affiliation?"
+ "checkbase": "Check the base domain of a URL for affiliation?",
+ "checkcontent": "Submit the affiliate content to other modules for analysis?"
}
# Internal results tracking
@@ -64,7 +67,7 @@ class sfp_xref(SpiderFootPlugin):
# What events is this module interested in for input
def watchedEvents(self):
- return ['URL', 'SIMILARDOMAIN']
+ return ['URL_EXTERNAL', 'SIMILARDOMAIN']
# Handle events sent to this module
# In this module's case, eventData will be the URL or a domain which
@@ -72,14 +75,14 @@ class sfp_xref(SpiderFootPlugin):
def handleEvent(self, srcModuleName, eventName, eventSource, eventData):
sf.debug("Received event, " + eventName + ", from " + srcModuleName)
- if eventData in self.fetched:
- sf.debug("Ignoring " + eventData + " as already tested")
- return
-
# The SIMILARDOMAIN event supplies domains, not URLs. Assume HTTP.
if eventName == 'SIMILARDOMAIN':
eventData = 'http://'+ eventData
+ if eventData in self.fetched:
+ sf.debug("Ignoring " + eventData + " as already tested")
+ return
+
# We are only interested in external sites for the xref
if sf.urlBaseDom(eventData) == self.baseDomain:
sf.debug("Ignoring " + eventData + " as not external")
@@ -125,6 +128,8 @@ class sfp_xref(SpiderFootPlugin):
self.results[url] = True
sf.debug("Found affiliate: " + url)
self.notifyListeners("AFFILIATE", eventSource, url)
+ if self.opts['checkcontent']:
+ self.notifyListeners("WEBCONTENT", url, res['content'])
return None
diff --git a/sfdbsetup.py b/sfdbsetup.py
index a19db11f..f89de644 100644
--- a/sfdbsetup.py
+++ b/sfdbsetup.py
@@ -75,7 +75,8 @@ class SpiderFootDbInit:
"INSERT INTO tbl_event_types (event, event_descr) VALUES ('SUBDOMAIN', 'Sub-domain')",
"INSERT INTO tbl_event_types (event, event_descr) VALUES ('SIMILARDOMAIN', 'Similar Domain')",
"INSERT INTO tbl_event_types (event, event_descr) VALUES ('TCP_PORT_OPEN', 'Open TCP Port')",
- "INSERT INTO tbl_event_types (event, event_descr) VALUES ('URL', 'URL')",
+ "INSERT INTO tbl_event_types (event, event_descr) VALUES ('URL_INTERNAL', 'URL - Internal')",
+ "INSERT INTO tbl_event_types (event, event_descr) VALUES ('URL_EXTERNAL', 'URL - External')",
"INSERT INTO tbl_event_types (event, event_descr) VALUES ('WEBCONTENT', 'Web Content')",
"INSERT INTO tbl_event_types (event, event_descr) VALUES ('WEBCONTENT_FORM', 'Web Content (Form)')",
"INSERT INTO tbl_event_types (event, event_descr) VALUES ('WEBCONTENT_HASFLASH', 'Web Content (Uses Flash)')",
diff --git a/sflib.py b/sflib.py
index 6c50d7b4..edc8b839 100644
--- a/sflib.py
+++ b/sflib.py
@@ -492,6 +492,10 @@ class SpiderFootPlugin(object):
# Call the handleEvent() method of every other plug-in listening for
# events from this plug-in. Remember that those plug-ins will be called
# within the same execution context of this thread, not on their own.
+ # eventName = the ID of the event, e.g. WEBCONTENT
+ # eventSource = the item where this event was extracted from, e.g. a URL
+ # eventData = the actual data for this event (would correspond to the eventName,
+ # so if we're reporting WEBCONTENT, eventData is the actual content.
def notifyListeners(self, eventName, eventSource, eventData):
# Check if we've been asked to stop in the meantime, so that
# notifications stop triggering module activity.
@@ -502,7 +506,7 @@ class SpiderFootPlugin(object):
#print "Notifications blocked for " + eventName + " to " + listener.__module__
return None
- if eventData == None or len(eventData) == 0:
+ if eventData == None or len(str(eventData)) == 0:
#print "No data to send for " + eventName + " to " + listener.__module__
return None