module WebSite

Public Instance Methods

has_basic_auth?() click to toggle source
# File lib/wpscan/modules/web_site.rb, line 69
def has_basic_auth?
  Browser.instance.get(@uri.to_s).code == 401
end
has_xml_rpc?() click to toggle source
# File lib/wpscan/modules/web_site.rb, line 60
def has_xml_rpc?
  !xml_rpc_url.nil?
end
is_online?() click to toggle source

Checks if the remote website is up.

# File lib/wpscan/modules/web_site.rb, line 65
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(
        xml_rpc_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 75
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
xml_rpc_url() click to toggle source
# File lib/wpscan/modules/web_site.rb, line 47
def xml_rpc_url
  unless @xmlrpc_url
    headers = Browser.instance.get(@uri.to_s).headers_hash
    value = headers["x-pingback"]
    if value.nil? or value.empty?
      @xmlrpc_url = nil
    else
      @xmlrpc_url = value
    end
  end
  @xmlrpc_url
end