Sha256: 812ccb23e613ffd58f37ddd1aacef93a5eaf6129c125538d86a43a4c54637240

Contents?: true

Size: 931 Bytes

Versions: 12

Compression:

Stored size: 931 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

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

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

    # @return [ String ]
    def type
      @type ||= self.class.to_s.demodulize.underscore
    end

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

Version data entries

12 entries across 12 versions & 1 rubygems

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