Sha256: e52aa512f1f7f2f06ad9621e4ef9d1fd3836a72d7ee0297fc16572436fb09bc2

Contents?: true

Size: 805 Bytes

Versions: 4

Compression:

Stored size: 805 Bytes

Contents

module CMSScanner
  # Interesting Finding
  class InterestingFinding
    include NS::Finders::Finding

    attr_reader :url
    attr_writer :to_s

    # @param [ String ] url
    # @param [ Hash ] opts
    #   :to_s (override the to_s method)
    #   See Finders::Finding for other available options
    def initialize(url, opts = {})
      @url  = url
      @to_s = opts[:to_s]

      parse_finding_options(opts)
    end

    # @return [ Array<String> ]
    def entries
      res = NS::Browser.get(url)

      return [] unless res && res.headers['Content-Type'] =~ /\Atext\/plain;/i

      res.body.split("\n").reject { |s| s.strip.empty? }
    end

    def to_s
      @to_s || url
    end

    def ==(other)
      return false unless self.class == other.class
      to_s == other.to_s
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cms_scanner-0.0.23 app/models/interesting_finding.rb
cms_scanner-0.0.22 app/models/interesting_finding.rb
cms_scanner-0.0.21 app/models/interesting_finding.rb
cms_scanner-0.0.20 app/models/interesting_finding.rb