Class: Snackhack2::TomCat

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

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ TomCat

Returns a new instance of TomCat.



4
5
6
# File 'lib/snackhack2/tomcat.rb', line 4

def initialize(site)
  @site = site
end

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/snackhack2/tomcat.rb', line 8

def run
  tc = Snackhack2::get(File.join(@site, "/docs/"))
  if tc.code == 404
    if tc.body.include?("Tomcat")
      doc = Nokogiri::HTML(tc.body)
      version = doc.at('h3').text
      puts "[+] Looks like the site is Tomcat, running #{version}."
    end
  else
    puts "[+] Status code: #{tc.code}"
  end
end