SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Load user agents from file, added VERSION file, updated version in header.
smicallef2f4515e1a56c
diff --git a/VERSION b/VERSIONnew file mode 100644index 00000000..22750eba--- /dev/null+++ b/VERSION@@ -0,0 +1 @@+SpiderFoot 2.0.2diff --git a/dyn/HEADER.tmpl b/dyn/HEADER.tmplindex 3cb6415b..c2759b55 100644--- a/dyn/HEADER.tmpl+++ b/dyn/HEADER.tmpl@@ -87,7 +87,7 @@<p>SpiderFoot is an open source footprinting tool, created by <a href='http://www.binarypool.com' target=_new>Steve Micallef</a>. It is designed to be easy to use, fast and extensible.</p><p>If you have any bugs to report, or requests for enhancements, please contact the support mailing list at <a href=mailto:[email protected]>[email protected]</a>.<br>- <p>You are running version <b>2.0.0</b>.</p>+ <p>You are running version <b>2.0.2</b>.</p><p> Visit the project website at <a href='http://www.spiderfoot.net' target=_new>http://www.spiderfoot.net</a>.</p></div><div class="modal-footer">diff --git a/modules/sfp_googlesearch.py b/modules/sfp_googlesearch.pyindex ada60d06..087253b0 100644--- a/modules/sfp_googlesearch.py+++ b/modules/sfp_googlesearch.py@@ -23,14 +23,12 @@ class sfp_googlesearch(SpiderFootPlugin):# Default optionsopts = {- 'useragent': 'Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0','fetchlinks': True, # Should we fetch links on the base domain?'pages': 20 # Number of google results pages to iterate}# Option descriptionsoptdescs = {- 'useragent': "User-Agent string to use when fetching Google pages.",'fetchlinks': "Fetch links found on the target domain-name?",'pages': "Number of Google results pages to iterate through."}diff --git a/modules/sfp_similar.py b/modules/sfp_similar.pyindex 05e032e1..dc089ad9 100644--- a/modules/sfp_similar.py+++ b/modules/sfp_similar.py@@ -46,8 +46,6 @@ class sfp_similar(SpiderFootPlugin):# Default optionsopts = {- # Domaintools will 403 you without a browser-like useragent- 'useragent': 'Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20100101 Firefox/11.0','source': 'ALL', # domaintools, namedroppers or ALL'method': 'left,right', # left and/or right (doesn't apply to whois.com)'activeonly': False # Only report domains that have content (try to fetch the page)@@ -55,7 +53,6 @@ class sfp_similar(SpiderFootPlugin):# Option descriptionsoptdescs = {- 'useragent': "User-Agent string to use when fetching pages from providers.",'source': "Provider to use: 'domaintools', 'namedroppers' or 'ALL'.",'method': "Pattern search method to use: 'left,right', 'left' or 'right'.",'activeonly': "Only report domains that have content (try to fetch the page)?"diff --git a/sf.py b/sf.pyindex 627c6bae..67e9a828 100755--- a/sf.py+++ b/sf.py@@ -26,7 +26,7 @@ sfConfig = {'_useragent': 'SpiderFoot/2.0', # User-Agent to use for HTTP requests'_fetchtimeout': 5, # number of seconds before giving up on a fetch'__database': 'spiderfoot.db',- '__webaddr': '127.0.0.1',+ '__webaddr': '0.0.0.0','__webport': 5001,'__guid__': None, # unique ID of scan. Will be set after start-up.'__modules__': None # List of modules. Will be set after start-up.@@ -34,7 +34,7 @@ sfConfig = {sfOptdescs = {'_debug': "Enable debugging?",- '_useragent': "Default User-Agent string to use for HTTP requests. Can be overridden by individual modules.",+ '_useragent': "User-Agent string to use for HTTP requests. Prefix with an '@' to randomly select the User Agent from a file containing user agent strings for each request, e.g. @C:\useragents.txt or @/home/bob/useragents.txt.",'_fetchtimeout': "Number of seconds before giving up on a HTTP request.",'_modulesenabled': "Modules enabled for the scan." # This is a hack to get a description for# an option not actually available.diff --git a/sflib.py b/sflib.pyindex 934981b3..043ee23e 100644--- a/sflib.py+++ b/sflib.py@@ -14,6 +14,7 @@ import inspectimport hashlibimport reimport os+import randomimport sysimport timeimport urllib2@@ -30,6 +31,18 @@ class SpiderFoot:self.handle = handleself.opts = options+ # For the useragent option, if the user has supplied a path,+ # open the file and load into options['__useragent_list']+ if "_useragent" in options.keys():+ if options["_useragent"].startswith("@"):+ fname = options["_useragent"].split('@')[1]+ try:+ f = open(fname, "r")+ options['__useragent_list'] = f.readlines()+ except BaseException as b:+ self.error("Unable to open User Agent file, " + fname + ".")+ options["__useragent_list"] = [ "Unknown" ]+## Debug, error message and logging functions#@@ -417,11 +430,12 @@ class SpiderFoot:try:header = dict()- if self.opts.has_key('_useragent'):+ if self.opts.has_key('_useragent') and not self.opts['_useragent'].startswith('@'):header['User-Agent'] = self.opts['_useragent']- # Let modules override- if self.opts.has_key('useragent'):- header['User-Agent'] = self.opts['useragent']+ if self.opts.has_key('__useragent_list'):+ header['User-Agent'] = random.choice(self.opts['__useragent_list'])++ print "HEADER: " + header['User-Agent']if not self.opts.has_key('_fetchtimeout'):self.opts['_fetchtimeout'] = 30