Class: CMSScanner::InterestingFinding

Inherits:
Object
  • Object
show all
Defined in:
app/models/interesting_finding.rb

Overview

Interesting Finding

Direct Known Subclasses

FantasticoFileslist, Headers, RobotsTxt, XMLRPC

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, opts = {}) ⇒ InterestingFinding

Returns a new instance of InterestingFinding.

Parameters:

  • url (String)
  • opts (Hash) (defaults to: {})

    :to_s (override the to_s method) See Finders::Finding for other available options



13
14
15
16
17
18
# File 'app/models/interesting_finding.rb', line 13

def initialize(url, opts = {})
  @url  = url
  @to_s = opts[:to_s]

  parse_finding_options(opts)
end

Instance Attribute Details

#to_sObject



29
30
31
# File 'app/models/interesting_finding.rb', line 29

def to_s
  @to_s || url
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'app/models/interesting_finding.rb', line 6

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
36
# File 'app/models/interesting_finding.rb', line 33

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

#entriesArray<String>

Returns:

  • (Array<String>)


21
22
23
24
25
26
27
# File 'app/models/interesting_finding.rb', line 21

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