Skip to content

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

Better case sensitivity.

smicallef52ab7bc027fc
diff --git a/dyn/newscan.tmpl b/dyn/newscan.tmpl
index 3644a41a..c4fd8d3a 100644
--- a/dyn/newscan.tmpl
+++ b/dyn/newscan.tmpl
@@ -23,7 +23,7 @@ Another scan is currently running (${runningScan}). Please either wait for that
<div class="control-group">
<label class="control-label" for="scanname">Scan Name</label>
<div class="controls">
- <input type="text" id="scanname" name="scanname" placeholder="A unique name for this scan.">
+ <input type="text" id="scanname" name="scanname" placeholder="Descriptive name for this scan.">
</div>
</div>
<div class="control-group">
diff --git a/dyn/scaninfo.tmpl b/dyn/scaninfo.tmpl
index 1f6d5d1f..6027fcdc 100644
--- a/dyn/scaninfo.tmpl
+++ b/dyn/scaninfo.tmpl
@@ -80,11 +80,13 @@
currentType = eventType;
sf.fetchData('/scaneventresults', {'id': instanceId, 'eventType': eventType }, function(data) {
var table = "<table id='scansummary-content' class='table table-bordered table-striped small'>";
- table += "<thead><tr> <th>Data Element</th><th>Source</th></tr></thead><tbody>";
+ table += "<thead><tr> <th>Data Element</th><th>Source</th><th>Module</th></tr></thead><tbody>";
for (var i = 0; i < data.length; i++) {
table += "<tr><td width=50%><pre style='border: 0px; background-color: inherit'>" + data[i][1];
table += "</pre></td><td><pre style='border: 0px; background-color: inherit'>" + data[i][2];
- table += "</pre></td></tr>";
+ table += "</pre></td><td><pre style='border: 0px; background-color: inherit'>" + data[i][3];
+ table += "</pre></td>";
+ table += "</tr>";
}
table += "</tbody></table>"
$("#loader").fadeOut(500);
diff --git a/modules/sfp_dns.py b/modules/sfp_dns.py
index 8d521f31..e46f7966 100644
--- a/modules/sfp_dns.py
+++ b/modules/sfp_dns.py
@@ -87,7 +87,7 @@ class sfp_dns(SpiderFootPlugin):
# If the returned hostname is on a different
# domain to baseDomain, flag it as an affiliate
- if not host.endswith(self.baseDomain):
+ if not host.lower().endswith(self.baseDomain):
self.notifyListeners("AFFILIATE", eventData, host)
else:
self.notifyListeners("SUBDOMAIN", eventData, host)
diff --git a/modules/sfp_googlesearch.py b/modules/sfp_googlesearch.py
index 16b0b966..e7fc10ed 100644
--- a/modules/sfp_googlesearch.py
+++ b/modules/sfp_googlesearch.py
@@ -115,7 +115,7 @@ class sfp_googlesearch(SpiderFootPlugin):
return returnResults
returnResults[nextUrl] = nextPage['content']
- matches = re.findall("(\/search\S+start=\d+.[^\'\"]*)", nextPage['content'])
+ matches = re.findall("(\/search\S+start=\d+.[^\'\"]*)", nextPage['content'], re.IGNORECASE)
return returnResults
diff --git a/modules/sfp_mail.py b/modules/sfp_mail.py
index 5acc9ef5..c2f9810a 100644
--- a/modules/sfp_mail.py
+++ b/modules/sfp_mail.py
@@ -64,7 +64,7 @@ class sfp_mail(SpiderFootPlugin):
sf.debug("Likely invalid address.")
continue
- if self.baseDomain not in match:
+ if self.baseDomain not in match.lower():
sf.debug("E-mail (or something) from somewhere else..")
continue
@@ -76,13 +76,13 @@ class sfp_mail(SpiderFootPlugin):
# Include e-mail addresses on sub-domains within the domain?
if not self.opts['includesubdomains']:
- if not match.endswith('@' + self.baseDomain):
+ if not match.lower().endswith('@' + self.baseDomain):
sf.debug("Ignoring e-mail address on a sub-domain: " + match)
continue
# Include external domains as e-mail addresses?
if not self.opts['includeexternal']:
- if not match.endswith(self.baseDomain):
+ if not match.lower().endswith(self.baseDomain):
sf.debug("Ignoring e-mail address on an external domain" + match)
continue
diff --git a/modules/sfp_similar.py b/modules/sfp_similar.py
index 58d4e1fa..3e7ec409 100644
--- a/modules/sfp_similar.py
+++ b/modules/sfp_similar.py
@@ -78,7 +78,8 @@ class sfp_similar(SpiderFootPlugin):
self.opts[opt] = userOpts[opt]
def findDomains(self, keyword, content):
- matches = re.findall("([a-z0-9\-]*" + keyword + "[a-z0-9\-]*\.[a-z]+)", content)
+ matches = re.findall("([a-z0-9\-]*" + keyword + "[a-z0-9\-]*\.[a-z]+)",
+ content, re.IGNORECASE)
return matches
diff --git a/modules/sfp_subdomain.py b/modules/sfp_subdomain.py
index 6ad81357..fa74f594 100644
--- a/modules/sfp_subdomain.py
+++ b/modules/sfp_subdomain.py
@@ -51,7 +51,7 @@ class sfp_subdomain(SpiderFootPlugin):
for match in matches:
# Skip URL encoded /
- if match.startswith("2F") or match.startswith("2f"):
+ if match.lower().startswith("2f"):
continue
sf.debug("Found sub-domain: " + match)
diff --git a/modules/sfp_xref.py b/modules/sfp_xref.py
index bc36efe3..6c9c3509 100644
--- a/modules/sfp_xref.py
+++ b/modules/sfp_xref.py
@@ -68,7 +68,7 @@ class sfp_xref(SpiderFootPlugin):
# The SIMILARDOMAIN event supplies domains, not URLs. Assume HTTP.
if eventName == 'SIMILARDOMAIN':
- eventData = 'http://'+ eventData
+ eventData = 'http://'+ eventData.lower()
# We are only interested in external sites for the xref
if sf.urlBaseUrl(eventData).endswith(self.baseDomain):
@@ -97,7 +97,7 @@ class sfp_xref(SpiderFootPlugin):
# Search for mentions of our domain in the external site's data
matches = re.findall("([\.\'\/\"\ ]" + self.baseDomain + "[\.\'\"\ ])",
- res['content'], re.IGNORECASE)
+ res['content'], re.IGNORECASE)
# If the domain wasn't found in the affiliate, and checkbase is set,
# fetch the base URL of the affiliate to check for a xref. Don't bother
diff --git a/sflib.py b/sflib.py
index bdf29b39..8c9305af 100644
--- a/sflib.py
+++ b/sflib.py
@@ -241,20 +241,20 @@ class SpiderFoot:
# checks.
def urlBaseUrl(self, url):
if '://' in url:
- bits = re.match('(\w+://.[^/]*)/.*', url)
+ bits = re.match('(\w+://.[^/:]*)[:/].*', url)
else:
- bits = re.match('(.[^/]*)/', url)
+ bits = re.match('(.[^/:]*)[:/]', url)
if bits == None:
- return url
+ return url.lower()
self.debug('base url of ' + url + ' is: ' + bits.group(1))
- return bits.group(1)
+ return bits.group(1).lower()
# Extract the keyword (the domain without the TLD or any subdomains)
# from a domain. Crude for now.. just gets the first word.
def domainKeyword(self, domain):
- return domain.split('.', 2)[0]
+ return domain.split('.', 2)[0].lower()
#
# General helper functions to automate many common tasks between modules
@@ -268,8 +268,8 @@ class SpiderFoot:
# We don't check the User-Agent rule yet.. probably should at some stage
for line in robotsTxtData.splitlines():
- if line.startswith('Disallow:'):
- m = re.match('Disallow:\s*(.[^ #]*)', line)
+ if line.lower().startswith('disallow:'):
+ m = re.match('disallow:\s*(.[^ #]*)', line, re.IGNORECASE)
self.debug('robots.txt parsing found disallow: ' + m.group(1))
returnArr.append(m.group(1))
continue
@@ -319,7 +319,7 @@ class SpiderFoot:
# Don't include stuff likely part of some dynamically built incomplete
# URL found in Javascript code (character is part of some logic)
- if link[len(link)-1] == '.' or link[0] == '+' or 'javascript:' in link or '();' in link:
+ if link[len(link)-1] == '.' or link[0] == '+' or 'javascript:' in link.lower() or '();' in link:
self.debug('unlikely link: ' + link)
continue
@@ -329,12 +329,12 @@ class SpiderFoot:
continue
# Ignore mail links
- if 'mailto:' in link:
+ if 'mailto:' in link.lower():
self.debug("Ignoring mail link: " + link)
continue
# URL decode links
- if '%2F' in link or '%2f' in link:
+ if '%2f' in link.lower():
link = urllib2.unquote(link)
# Capture the absolute link:
@@ -347,7 +347,7 @@ class SpiderFoot:
absLink = self.urlBaseUrl(url) + link
# Maybe the domain was just mentioned and not a link, so we make it one
- if absLink == None and domain in link:
+ if absLink == None and domain.lower() in link.lower():
absLink = 'http://' + link
# Otherwise, it's a flat link within the current directory
diff --git a/sfscan.py b/sfscan.py
index 778789c3..8614474b 100644
--- a/sfscan.py
+++ b/sfscan.py
@@ -10,9 +10,11 @@
#-----------------------------------------------------------------
import json
import threading
+import traceback
import os
import time
import urllib2
+import sys
from copy import deepcopy
from sfdb import SpiderFootDb
from sflib import SpiderFoot
@@ -137,9 +139,17 @@ class SpiderFootScanner:
dbh.scanInstanceSet(self.config['__guid__'], None, time.time() * 1000, 'FINISHED')
self.status = "FINISHED"
except Exception as e:
+ exc_type, exc_value, exc_traceback = sys.exc_info()
self.sf.error("Scan [" + self.config['__guid__'] + "] failed: " + str(e))
dbh.scanInstanceSet(self.config['__guid__'], None, time.time() * 1000, 'ERROR-FAILED')
self.status = "ERROR-FAILED"
+ self.moduleInstances = None
+ dbh.close()
+ self.sf.setDbh(None)
+ self.sf.setScanId(None)
+
+ sf.fatal("Unhandled exception encountered during scan. Please report this as a bug: " + \
+ repr(traceback.format_exception(exc_type, exc_value, exc_traceback)))
self.moduleInstances = None
dbh.close()
diff --git a/sfwebui.py b/sfwebui.py
index 7c7f78ad..db21e079 100644
--- a/sfwebui.py
+++ b/sfwebui.py
@@ -190,7 +190,7 @@ class SpiderFootWebUi:
return templ.render(modules=self.config['__modules__'], alreadyRunning=True, runningScan=thread.name[3:])
# Start running a new scan
- self.scanner = SpiderFootScanner(scanname, scantarget, modlist, self.config, modopts)
+ self.scanner = SpiderFootScanner(scanname, scantarget.lower(), modlist, self.config, modopts)
t = threading.Thread(name="SF_" + scanname, target=self.scanner.startScan)
t.start()