Class: Snackhack2::SiteMap

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

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ SiteMap

Returns a new instance of SiteMap.



5
6
7
# File 'lib/snackhack2/sitemap.rb', line 5

def initialize(site)
  @site = site
end

Instance Method Details

#runObject



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

def run
  sm = Snackhack2::get(File.join(@site, "sitemap.xml"))
  if sm.code == 200
    if !sm.body.include?("Not Found")
      Snackhack2::file_save(@site, "site.xml", sm.body)
    else
      puts "[+] Eh. I don't think the site has a sitemap. Manually check just in case... :(\n\n"
    end
  else
    puts "[+] Status Code: #{sm.code}"
  end
end