Return the MD5 hash of a 404 page
# File lib/wpscan/web_site.rb, line 91 def error_404_hash unless @error_404_hash non_existant_page = Digest::MD5.hexdigest(rand(999_999_999).to_s) + '.html' @error_404_hash = WebSite.page_hash(@uri.merge(non_existant_page).to_s) end @error_404_hash end
# File lib/wpscan/web_site.rb, line 23 def has_basic_auth? Browser.instance.get(@uri.to_s).code == 401 end
Checks if a robots.txt file exists
# File lib/wpscan/web_site.rb, line 107 def has_robots? Browser.instance.get(robots_url).code == 200 end
# File lib/wpscan/web_site.rb, line 27 def has_xml_rpc? !xml_rpc_url.nil? end
# File lib/wpscan/web_site.rb, line 83 def homepage_hash unless @homepage_hash @homepage_hash = WebSite.page_hash(@uri.to_s) end @homepage_hash end
Checks if the remote website is up.
# File lib/wpscan/web_site.rb, line 19 def online? Browser.instance.get(@uri.to_s).code != 0 end
See if the remote url returns 30x redirect This method is recursive Return a string with the redirection or nil
# File lib/wpscan/web_site.rb, line 61 def redirection(url = nil) redirection = nil url ||= @uri.to_s response = Browser.instance.get(url) if response.code == 301 || response.code == 302 redirection = response.headers_hash['location'] # Let's check if there is a redirection in the redirection if other_redirection = redirection(redirection) redirection = other_redirection end end redirection end
Gets a robots.txt URL
# File lib/wpscan/web_site.rb, line 112 def robots_url robots = @uri.clone robots.path = '/robots.txt' robots.to_s end
Will try to find the rss url in the homepage Only the first one found iw returned
# File lib/wpscan/web_site.rb, line 101 def rss_url homepage_body = Browser.instance.get(@uri.to_s).body homepage_body[%{<link .* type="application/rss\+xml" .* href="([^"]+)" />}, 1] end
# File lib/wpscan/web_site.rb, line 10 def url=(url) @uri = URI.parse(add_trailing_slash(add_http_protocol(url))) end
See www.hixie.ch/specs/pingback/pingback-1.0#TOC2.3
# File lib/wpscan/web_site.rb, line 32 def xml_rpc_url unless @xmlrpc_url @xmlrpc_url = xml_rpc_url_from_headers() || xml_rpc_url_from_body() end @xmlrpc_url end
# File lib/wpscan/web_site.rb, line 52 def xml_rpc_url_from_body body = Browser.instance.get(@uri.to_s).body body[%{<link rel="pingback" href="([^"]+)" ?\/?>}, 1] end
# File lib/wpscan/web_site.rb, line 39 def xml_rpc_url_from_headers headers = Browser.instance.get(@uri.to_s).headers_hash xmlrpc_url = nil unless headers.nil? pingback_url = headers['X-Pingback'] unless pingback_url.nil? || pingback_url.empty? xmlrpc_url = pingback_url end end xmlrpc_url end
Generated with the Darkfish Rdoc Generator 2.