Skip to content

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

Changed target to domains instead of seed URLs.

smicallef10fa86701b4d
diff --git a/dyn/newscan.tmpl b/dyn/newscan.tmpl
index 45e86523..3644a41a 100644
--- a/dyn/newscan.tmpl
+++ b/dyn/newscan.tmpl
@@ -27,9 +27,9 @@ Another scan is currently running (${runningScan}). Please either wait for that
</div>
</div>
<div class="control-group">
- <label class="control-label" for="scantarget">Seed URL</label>
+ <label class="control-label" for="scantarget">Target Domain Name</label>
<div class="controls">
- <input type="text" id="scantarget" name="scantarget" placeholder="e.g. http://www.scantarget.com">
+ <input type="text" id="scantarget" name="scantarget" placeholder="e.g. scantarget.com">
</div>
</div>
<div class="control-group">
diff --git a/dyn/scaninfo.tmpl b/dyn/scaninfo.tmpl
index f99618fc..1f6d5d1f 100644
--- a/dyn/scaninfo.tmpl
+++ b/dyn/scaninfo.tmpl
@@ -58,7 +58,7 @@
$("#loader").show();
sf.fetchData('/scansummary', {'id': instanceId}, function(data) {
var table = "<table id='scansummary-content' class='table table-bordered table-striped'>";
- table += "<thead><tr> <th>Type</th> <th>Events</th><th>Last Provided</th></tr></thead><tbody>";
+ table += "<thead><tr> <th>Type</th> <th>Data Elements</th><th>Last Data Element</th></tr></thead><tbody>";
for (var i = 0; i < data.length; i++) {
table += "<tr><td><a onClick='";
table += "browseEventData(\"${id}\", \"" + data[i][0] + "\")' href='#'>";
diff --git a/modules/sfp_dns.py b/modules/sfp_dns.py
index c170a7ce..8d521f31 100644
--- a/modules/sfp_dns.py
+++ b/modules/sfp_dns.py
@@ -36,24 +36,20 @@ class sfp_dns(SpiderFootPlugin):
'reverselookup': "Obtain new URLs and possible affiliates based on reverse-resolved IPs?"
}
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
self.results = dict()
+ self.baseDomain = target
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
arr = ['SUBDOMAIN']
diff --git a/modules/sfp_geoip.py b/modules/sfp_geoip.py
index 69ce235e..b0014df7 100644
--- a/modules/sfp_geoip.py
+++ b/modules/sfp_geoip.py
@@ -25,24 +25,20 @@ class sfp_geoip(SpiderFootPlugin):
# Default options
opts = { }
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return ['IP_ADDRESS']
diff --git a/modules/sfp_googlesearch.py b/modules/sfp_googlesearch.py
index ea30973e..16b0b966 100644
--- a/modules/sfp_googlesearch.py
+++ b/modules/sfp_googlesearch.py
@@ -35,24 +35,20 @@ class sfp_googlesearch(SpiderFootPlugin):
'pages': "Number of Google results pages to iterate through."
}
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
results = list()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return None
@@ -145,7 +141,7 @@ class sfp_googlesearch(SpiderFootPlugin):
# We can optionally fetch links to our domain found in the search
# results. These may not have been identified through spidering.
if self.opts['fetchlinks']:
- links = sf.parseLinks(page, pages[page])
+ links = sf.parseLinks(page, pages[page], self.baseDomain)
if len(links) == 0:
continue
@@ -153,10 +149,7 @@ class sfp_googlesearch(SpiderFootPlugin):
if link in self.results:
continue
sf.debug("Found a link: " + link)
- baseDom = sf.urlBaseDom(link)
- if baseDom == None:
- continue
- if baseDom.endswith(self.baseDomain):
+ if sf.urlBaseUrl(link).endswith(self.baseDomain):
if self.checkForStop():
return None
linkPage = sf.fetchUrl(link)
diff --git a/modules/sfp_mail.py b/modules/sfp_mail.py
index 54b244ed..5acc9ef5 100644
--- a/modules/sfp_mail.py
+++ b/modules/sfp_mail.py
@@ -34,24 +34,20 @@ class sfp_mail(SpiderFootPlugin):
'includeexternal': "Report e-mail addresses not on the target base domain-name?"
}
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return ["WEBCONTENT"]
diff --git a/modules/sfp_pageinfo.py b/modules/sfp_pageinfo.py
index c071ae71..866c1257 100644
--- a/modules/sfp_pageinfo.py
+++ b/modules/sfp_pageinfo.py
@@ -36,24 +36,20 @@ etc.)"""
# Default options
opts = { }
- # URL this instance is working on
- seedUrl = None
+ # Target
baseDomain = None # calculated from the URL in setup
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return ["WEBCONTENT"]
@@ -64,7 +60,7 @@ etc.)"""
# We aren't interested in describing pages that are not hosted on
# our base domain.
- if sf.urlBaseDom(eventSource) != self.baseDomain:
+ if not sf.urlBaseUrl(eventSource).endswith(self.baseDomain):
sf.debug("Not gathering page info for external site " + eventSource)
return None
diff --git a/modules/sfp_portscan_basic.py b/modules/sfp_portscan_basic.py
index 3f8db8d2..95c901fc 100644
--- a/modules/sfp_portscan_basic.py
+++ b/modules/sfp_portscan_basic.py
@@ -40,24 +40,20 @@ class sfp_portscan_basic(SpiderFootPlugin):
'randomize': "Randomize the order of ports scanned."
}
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
if self.opts['randomize']:
random.shuffle(self.opts['ports'])
diff --git a/modules/sfp_ripe.py b/modules/sfp_ripe.py
index 2d937587..70236761 100644
--- a/modules/sfp_ripe.py
+++ b/modules/sfp_ripe.py
@@ -25,24 +25,20 @@ class sfp_ripe(SpiderFootPlugin):
# Default options
opts = { }
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return ['IP_ADDRESS', 'SUBDOMAIN']
diff --git a/modules/sfp_similar.py b/modules/sfp_similar.py
index f0026cd3..58d4e1fa 100644
--- a/modules/sfp_similar.py
+++ b/modules/sfp_similar.py
@@ -64,23 +64,19 @@ class sfp_similar(SpiderFootPlugin):
# Internal results tracking
results = list()
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = list()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
def findDomains(self, keyword, content):
matches = re.findall("([a-z0-9\-]*" + keyword + "[a-z0-9\-]*\.[a-z]+)", content)
@@ -210,8 +206,8 @@ class sfp_similar(SpiderFootPlugin):
# Search for similar sounding domains
def start(self):
- keyword = sf.urlKeyword(self.seedUrl)
- sf.debug("Keyword extracted from " + self.seedUrl + ": " + keyword)
+ keyword = sf.domainKeyword(self.baseDomain)
+ sf.debug("Keyword extracted from " + self.baseDomain + ": " + keyword)
if "whois" in self.opts['source'] or "ALL" in self.opts['source']:
self.scrapeWhois(keyword)
diff --git a/modules/sfp_spider.py b/modules/sfp_spider.py
index 15a62cc6..0deaef0c 100644
--- a/modules/sfp_spider.py
+++ b/modules/sfp_spider.py
@@ -27,6 +27,7 @@ class sfp_spider(SpiderFootPlugin):
'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
+ 'start': [ 'http://', 'https://', 'http://www.', 'https://www.' ],
'filterfiles': ['png','gif','jpg','jpeg','tiff', 'tif', 'js', 'css',
'pdf','tif','ico','flv', 'mp4', 'mp3', 'avi', 'mpg',
'mpeg', 'iso', 'dat', 'mov', 'swf'], # Extensions to not fetch
@@ -39,6 +40,7 @@ class sfp_spider(SpiderFootPlugin):
optdescs = {
'robotsonly': "Only follow links specified by robots.txt?",
'pause': "Number of seconds to pause between fetches.",
+ 'start': "Prepend the target with these until you get a hit, to start spidering.",
'maxpages': "Maximum number of pages to fetch.",
'maxlevels': "Maximum levels to traverse within a site.",
'filterfiles': "File extensions to ignore (don't fetch them.)",
@@ -50,9 +52,11 @@ class sfp_spider(SpiderFootPlugin):
# If using robots.txt, this will get populated with filter rules
robotsRules = dict()
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in __init__
+ # Target
+ baseDomain = None
+
+ # Where to start spidering from
+ spiderSource = None
# Results of spidering. This is a dictionary with the URL as the key, and
# each value is again a dictionary of the following key=value pairs:
@@ -62,30 +66,30 @@ class sfp_spider(SpiderFootPlugin):
# >> Not all of these will be populated at the same time <<
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- if '://' not in self.seedUrl:
- sf.error("Please specify a full URL starting point, prefixed with http:// or https://")
- return None
+ # Determine where to start spidering from
+ for prefix in self.opts['start']:
+ res = sf.fetchUrl(prefix + target)
+ if res['content'] != None:
+ self.spiderSource = prefix + target
+ break
- if re.match('.*\d+\.\d+\.\d+\.\d+.*', self.seedUrl):
- sf.error("Need a named URL to start with, not an IP.")
+ if self.spiderSource == None:
+ sf.error("Unable to fetch any start pages for the requested target.")
return None
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# Are we respecting robots.txt?
if self.opts['robotsonly']:
- robotsTxt = sf.fetchUrl(sf.urlBaseUrl(self.seedUrl) + '/robots.txt').read()
+ robotsTxt = sf.fetchUrl(self.spiderSource + '/robots.txt')
if robotsTxt['content'] != None:
sf.debug('robots.txt contents: ' + robotsTxt['content'])
self.robotsRules = sf.parseRobotsTxt(robotsTxt['content'])
@@ -107,7 +111,7 @@ class sfp_spider(SpiderFootPlugin):
if source != None:
self.results[url]['source'] = source
- if self.baseDomain == sf.urlBaseDom(url):
+ if sf.urlBaseUrl(url).endswith(self.baseDomain):
self.notifyListeners("URL_INTERNAL", source, url)
else:
self.notifyListeners("URL_EXTERNAL", source, url)
@@ -149,7 +153,7 @@ class sfp_spider(SpiderFootPlugin):
self.storeResult(url, None, None, fetched)
# Extract links from the content
- links = sf.parseLinks(url, fetched['content'])
+ links = sf.parseLinks(url, fetched['content'], self.baseDomain)
if links == None or len(links) == 0:
sf.debug("No links found at " + url)
@@ -163,13 +167,13 @@ class sfp_spider(SpiderFootPlugin):
returnLinks = dict()
for link in links.keys():
- # Optionally skip external sites
- if self.opts['noexternal'] and self.baseDomain != sf.urlBaseDom(link):
+ # Optionally skip external sites (typical behaviour..)
+ if self.opts['noexternal'] and not sf.urlBaseUrl(link).endswith(self.baseDomain):
sf.debug('Ignoring external site: ' + link)
continue
# Optionally skip sub-domain sites
- if self.opts['nosubs'] and sf.urlBaseUrl(self.seedUrl) not in link:
+ if self.opts['nosubs'] and not sf.urlBaseUrl(link).endswith('://' + self.baseDomain):
sf.debug("Ignoring subdomain: " + link)
continue
@@ -203,7 +207,7 @@ class sfp_spider(SpiderFootPlugin):
# Iterations after that are based on links found on those pages,
# and so on..
keepSpidering = True
- links = self.processUrl(self.seedUrl) # fetch first page
+ links = self.processUrl(self.spiderSource) # fetch first page
totalFetched = 0
levelsTraversed = 0
nextLinks = dict()
diff --git a/modules/sfp_stor_db.py b/modules/sfp_stor_db.py
index b2333c8f..4fc3a799 100644
--- a/modules/sfp_stor_db.py
+++ b/modules/sfp_stor_db.py
@@ -31,20 +31,17 @@ class sfp_stor_db(SpiderFootPlugin):
'maxstorage': "Maximum bytes to store for any piece of information retreived."
}
- # URL this instance is working on
- seedUrl = None
-
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
global sfdb
sf = sfc
- self.seedUrl = url
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
# Use the database handle passed to us
+ # Should change to get the DBH out of sfc
sfdb = userOpts['__sfdb__']
# What events is this module interested in for input
diff --git a/modules/sfp_stor_print.py b/modules/sfp_stor_print.py
index 335c8a80..17756204 100644
--- a/modules/sfp_stor_print.py
+++ b/modules/sfp_stor_print.py
@@ -28,14 +28,10 @@ class sfp_stor_print(SpiderFootPlugin):
"datasize": "Maximum number of bytes to print on the screen for debug."
}
- # URL this instance is working on
- seedUrl = None
-
- def __init__(self, sfc, url, userOpts=dict()):
+ def __init__(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
diff --git a/modules/sfp_subdomain.py b/modules/sfp_subdomain.py
index 6f337e23..6ad81357 100644
--- a/modules/sfp_subdomain.py
+++ b/modules/sfp_subdomain.py
@@ -22,24 +22,20 @@ class sfp_subdomain(SpiderFootPlugin):
# Default options
opts = { }
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in __init__
+ # Target
+ baseDomain = None
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return ["WEBCONTENT", "URL_INTERNAL"]
diff --git a/modules/sfp_template.py b/modules/sfp_template.py
index 1dfb8d5a..698774a7 100644
--- a/modules/sfp_template.py
+++ b/modules/sfp_template.py
@@ -34,24 +34,20 @@ class sfp_XXX(SpiderFootPlugin):
# Be sure to completely clear any class variables in setup()
# or you run the risk of data persisting between scan runs.
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
results = dict() # track results for duplicates
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return ["WEBCONTENT"]
diff --git a/modules/sfp_websvr.py b/modules/sfp_websvr.py
index 015a842c..c40769e4 100644
--- a/modules/sfp_websvr.py
+++ b/modules/sfp_websvr.py
@@ -23,24 +23,20 @@ class sfp_websvr(SpiderFootPlugin):
# Default options
opts = { }
- # URL this instance is working on
- seedUrl = None
+ # Target
baseDomain = None # calculated from the URL in setup
results = dict()
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return ["WEBSERVER_HTTPHEADERS"]
@@ -53,7 +49,7 @@ class sfp_websvr(SpiderFootPlugin):
else:
self.results[eventSource] = True
- if sf.urlBaseDom(eventSource) != self.baseDomain:
+ if not sf.urlBaseUrl(eventSource).endswith(self.baseDomain):
sf.debug("Not collecting web server information for external sites.")
return None
diff --git a/modules/sfp_xref.py b/modules/sfp_xref.py
index eced494b..bc36efe3 100644
--- a/modules/sfp_xref.py
+++ b/modules/sfp_xref.py
@@ -43,23 +43,19 @@ class sfp_xref(SpiderFootPlugin):
results = dict()
fetched = list()
- # URL this instance is working on
- seedUrl = None
- baseDomain = None # calculated from the URL in setup
+ # Target
+ baseDomain = None
- def setup(self, sfc, url, userOpts=dict()):
+ def setup(self, sfc, target, userOpts=dict()):
global sf
sf = sfc
- self.seedUrl = url
+ self.baseDomain = target
self.results = dict()
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
- # Extract the 'meaningful' part of the FQDN from the URL
- self.baseDomain = sf.urlBaseDom(self.seedUrl)
-
# What events is this module interested in for input
def watchedEvents(self):
return ['URL_EXTERNAL', 'SIMILARDOMAIN']
@@ -75,7 +71,7 @@ class sfp_xref(SpiderFootPlugin):
eventData = 'http://'+ eventData
# We are only interested in external sites for the xref
- if sf.urlBaseDom(eventData) == self.baseDomain:
+ if sf.urlBaseUrl(eventData).endswith(self.baseDomain):
sf.debug("Ignoring " + eventData + " as not external")
return None
diff --git a/sfdb.py b/sfdb.py
index 5d3a8145..c771dc8f 100644
--- a/sfdb.py
+++ b/sfdb.py
@@ -140,7 +140,7 @@ class SpiderFootDb:
# Obtain a summary of the results per event type
def scanResultSummary(self, instanceId):
- qry = "SELECT r.event, e.event_descr, max(ROUND(generated))/1000 AS last_in, \
+ qry = "SELECT r.event, e.event_descr, MAX(ROUND(generated))/1000 AS last_in, \
count(*) AS total FROM \
tbl_scan_results r, tbl_event_types e WHERE e.event = r.event \
AND r.scan_instance_id = ? GROUP BY r.event ORDER BY e.event_descr"
diff --git a/sflib.py b/sflib.py
index 5e36d053..bdf29b39 100644
--- a/sflib.py
+++ b/sflib.py
@@ -237,8 +237,9 @@ class SpiderFoot:
return base + '/'
# Extract the scheme and domain from a URL
+ # Does not return the trailing slash! So you can do .endswith()
+ # checks.
def urlBaseUrl(self, url):
-
if '://' in url:
bits = re.match('(\w+://.[^/]*)/.*', url)
else:
@@ -250,21 +251,9 @@ class SpiderFoot:
self.debug('base url of ' + url + ' is: ' + bits.group(1))
return bits.group(1)
- # Get the base domain from a URL
- def urlBaseDom(self, url):
- url = self.urlBaseUrl(url)
- basedomainBits = url.rsplit('.', 2)
- try:
- return basedomainBits[-2] + '.' + basedomainBits[-1]
- except IndexError:
- # Some error parsing the domain out of the URL
- return None
-
# Extract the keyword (the domain without the TLD or any subdomains)
- # from a URL
- def urlKeyword(self, url):
- base = self.urlBaseUrl(url)
- domain = self.urlBaseDom(base)
+ # from a domain. Crude for now.. just gets the first word.
+ def domainKeyword(self, domain):
return domain.split('.', 2)[0]
#
@@ -294,7 +283,7 @@ class SpiderFoot:
# The key will be the *absolute* URL of the link obtained, so for example if
# the link '/abc' was obtained from 'http://xyz.com', the key in the dict will
# be 'http://xyz.com/abc' with the 'original' attribute set to '/abc'
- def parseLinks(self, url, data):
+ def parseLinks(self, url, data, domain):
returnLinks = dict()
if data == None or len(data) == 0:
@@ -315,7 +304,7 @@ class SpiderFoot:
# Because we're working with a big blob of text now, don't worry
# about clobbering proper links by url decoding them.
data = urllib2.unquote(data)
- regRel = re.compile('(.)([a-zA-Z0-9\-\.]+\.'+self.urlBaseDom(url)+')',
+ regRel = re.compile('(.)([a-zA-Z0-9\-\.]+\.'+domain+')',
re.IGNORECASE)
urlsRel = urlsRel + regRel.findall(data)
except Exception as e:
@@ -358,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 self.urlBaseDom(url) in link:
+ if absLink == None and domain in link:
absLink = 'http://' + link
# Otherwise, it's a flat link within the current directory