Class: WappalyzerRb::Detector

Inherits:
Object
  • Object
show all
Defined in:
lib/wappalyzer_rb.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Detector

Returns a new instance of Detector.



11
12
13
14
# File 'lib/wappalyzer_rb.rb', line 11

def initialize(url)
  @url = url
  analyze!
end

Instance Attribute Details

#analysisObject (readonly)

Returns the value of attribute analysis.



9
10
11
# File 'lib/wappalyzer_rb.rb', line 9

def analysis
  @analysis
end

Class Method Details

.get(url) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/wappalyzer_rb.rb', line 16

def self.get(url)
  #TODO We could test with https too
  if url.match(/^http/)
    correct_url = url
  else
    correct_url = "http://#{url}"
  end

  uri = URI.parse(correct_url)

  if uri.respond_to? 'request_uri'
    http = Net::HTTP.new(uri.host, uri.port)
    request = Net::HTTP::Get.new(uri.request_uri)
    http.request(request)
  else
    puts "Incorrect URI"
  end
end