Sha256: c9fae588d8b4cc0ee1936ac7b7e53bbca7d331603033b6038c69e5fcba5f468d

Contents?: true

Size: 869 Bytes

Versions: 6

Compression:

Stored size: 869 Bytes

Contents

module CMSScanner
  # Interesting Finding
  class InterestingFinding
    include 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'] =~ %r{\Atext/plain;}i # rubocop:disable Style/SafeNavigation

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

    # @return [ String ]
    def to_s
      @to_s || url
    end

    # @return [ Boolean ]
    def ==(other)
      self.class == other.class && to_s == other.to_s
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cms_scanner-0.0.39.2 app/models/interesting_finding.rb
cms_scanner-0.0.39.1 app/models/interesting_finding.rb
cms_scanner-0.0.39.0 app/models/interesting_finding.rb
cms_scanner-0.0.38.4 app/models/interesting_finding.rb
cms_scanner-0.0.38.3 app/models/interesting_finding.rb
cms_scanner-0.0.38.2 app/models/interesting_finding.rb