Sha256: bb1272c9cce9b653f41685a05ed2c5adcf851bbaa846523d446a1dbf3df9d793

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

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

    def eql?(other)
      super(other) && interesting_entries == other.interesting_entries
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cms_scanner-0.0.37.12 app/models/headers.rb
cms_scanner-0.0.37.11 app/models/headers.rb
cms_scanner-0.0.37.10 app/models/headers.rb