Class: SiteInspector

Inherits:
Object
  • Object
show all
Defined in:
lib/site-inspector.rb,
lib/site-inspector/cache.rb,
lib/site-inspector/domain.rb,
lib/site-inspector/version.rb,
lib/site-inspector/endpoint.rb,
lib/site-inspector/checks/dns.rb,
lib/site-inspector/disk_cache.rb,
lib/site-inspector/checks/hsts.rb,
lib/site-inspector/rails_cache.rb,
lib/site-inspector/checks/check.rb,
lib/site-inspector/checks/https.rb,
lib/site-inspector/checks/whois.rb,
lib/site-inspector/checks/content.rb,
lib/site-inspector/checks/cookies.rb,
lib/site-inspector/checks/headers.rb,
lib/site-inspector/checks/sniffer.rb,
lib/site-inspector/checks/wappalyzer.rb,
lib/site-inspector/checks/accessibility.rb

Defined Under Namespace

Classes: Cache, DiskCache, Domain, Endpoint, RailsCache

Constant Summary collapse

VERSION =
'3.2.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cacheObject



37
38
39
40
41
42
43
44
45
# File 'lib/site-inspector.rb', line 37

def cache
  @cache ||= if ENV['CACHE']
               SiteInspector::DiskCache.new
             elsif Object.const_defined?('Rails')
               SiteInspector::RailsCache.new
             else
               SiteInspector::Cache.new
             end
end

.timeoutObject



47
48
49
# File 'lib/site-inspector.rb', line 47

def timeout
  @timeout || 10
end

.typhoeus_options=(value) ⇒ Object (writeonly)

Sets the attribute typhoeus_options

Parameters:

  • value

    the value to set the attribute typhoeus_options to.



35
36
37
# File 'lib/site-inspector.rb', line 35

def typhoeus_options=(value)
  @typhoeus_options = value
end

Class Method Details

.hydraObject

Returns a thread-safe, memoized hydra instance



70
71
72
# File 'lib/site-inspector.rb', line 70

def hydra
  Typhoeus::Hydra.hydra
end

.inspect(domain) ⇒ Object



51
52
53
# File 'lib/site-inspector.rb', line 51

def inspect(domain)
  Domain.new(domain)
end

.typhoeus_defaultsObject



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/site-inspector.rb', line 55

def typhoeus_defaults
  defaults = {
    followlocation: false,
    timeout: SiteInspector.timeout,
    accept_encoding: 'gzip',
    method: :head,
    headers: {
      'User-Agent' => "Mozilla/5.0 (compatible; SiteInspector/#{SiteInspector::VERSION}; +https://github.com/benbalter/site-inspector)"
    }
  }
  defaults.merge! @typhoeus_options if @typhoeus_options
  defaults
end