Class: CMSScanner::InterestingFile

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

Overview

Interesting File

Direct Known Subclasses

FantasticoFileslist, Headers, RobotsTxt, XMLRPC

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of InterestingFile.



8
9
10
11
# File 'app/models/interesting_file.rb', line 8

def initialize(url, opts = {})
  @url = url
  parse_finding_options(opts)
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object



26
27
28
29
# File 'app/models/interesting_file.rb', line 26

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

#entriesArray<String>

Returns:

  • (Array<String>)


14
15
16
17
18
19
20
# File 'app/models/interesting_file.rb', line 14

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

#to_sObject



22
23
24
# File 'app/models/interesting_file.rb', line 22

def to_s
  url
end