module WebSite

Public Instance Methods

is_online?() click to toggle source

Checks if the remote website is up.

# File lib/wpscan/modules/web_site.rb, line 52
def is_online?
  Browser.instance.get(@uri.to_s).code != 0
end
is_wordpress?() click to toggle source

check if the remote website is actually running wordpress.

# File lib/wpscan/modules/web_site.rb, line 23
def is_wordpress?
  wordpress = false

  response = Browser.instance.get(
      login_url(),
      {:follow_location => true, :max_redirects => 2}
  )

  if response.body =~ %r{WordPress}
    wordpress = true
  else
    response = Browser.instance.get(
        xmlrpc_url(),
        {:follow_location => true, :max_redirects => 2}
    )

    if response.body =~ %r{XML-RPC server accepts POST requests only}
      wordpress = true
    end
  end

  wordpress
end
redirection(url = nil) click to toggle source

see if the remote url returns 30x redirect return a string with the redirection or nil

# File lib/wpscan/modules/web_site.rb, line 58
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']
  end

  redirection
end
xmlrpc_url() click to toggle source
# File lib/wpscan/modules/web_site.rb, line 47
def xmlrpc_url
  @uri.merge("xmlrpc.php").to_s
end