Sha256: b0fe57e2f96155c8491aa589519b2c7ed33d8964f9b2f9a45536d4349d435019

Contents?: true

Size: 1.03 KB

Versions: 15

Compression:

Stored size: 1.03 KB

Contents

module CMSScanner
  # Interesting Headers
  class Headers < InterestingFinding
    # @return [ Hash ] The headers
    def entries
      res = NS::Browser.get(url)
      return [] unless res&.headers

      res.headers
    end

    # @return [ Array<String> ] The interesting headers detected
    def interesting_entries
      results = []

      entries.each do |header, value|
        next if known_headers.include?(header.downcase)

        results << "#{header}: #{[*value].join(', ')}"
      end
      results
    end

    # @return [ Array<String> ] Downcased known headers
    def known_headers
      %w[
        age accept-ranges cache-control content-encoding content-length content-type connection date
        etag expires keep-alive location last-modified link pragma set-cookie strict-transport-security
        transfer-encoding vary x-cache x-content-security-policy x-content-type-options
        x-frame-options x-language x-permitted-cross-domain-policies x-pingback x-varnish
        x-webkit-csp x-xss-protection
      ]
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cms_scanner-0.0.41.10 app/models/headers.rb
cms_scanner-0.0.41.9 app/models/headers.rb
cms_scanner-0.0.41.8 app/models/headers.rb
cms_scanner-0.0.41.7 app/models/headers.rb
cms_scanner-0.0.41.6 app/models/headers.rb
cms_scanner-0.0.41.5 app/models/headers.rb
cms_scanner-0.0.41.4 app/models/headers.rb
cms_scanner-0.0.41.3 app/models/headers.rb
cms_scanner-0.0.41.2 app/models/headers.rb
cms_scanner-0.0.41.1 app/models/headers.rb
cms_scanner-0.0.41.0 app/models/headers.rb
cms_scanner-0.0.40.3 app/models/headers.rb
cms_scanner-0.0.40.2 app/models/headers.rb
cms_scanner-0.0.40.1 app/models/headers.rb
cms_scanner-0.0.40 app/models/headers.rb