# -*- coding: binary -*- module Msf::HTTP::Wordpress::XmlRpc # Determines if the XMLRPC interface is enabled by sending a demo.sayHello request # # @return [Boolean] true if the interface is enabled def wordpress_xmlrpc_enabled? xml = wordpress_generate_xml_rpc_body('demo.sayHello') res = send_request_cgi( 'uri' => wordpress_url_xmlrpc, 'method' => 'POST', 'ctype' => 'text/xml;charset=UTF-8', 'data' => xml ) return true if res && res.body && res.body.to_s =~ /Hello!<\/string>/ return false end # Generates the xml post body for a XMLRPC call # # @param method_name [String] The XMLRPC method to call # @param params [String] The XMLRPC method params # @return [String] xml string def wordpress_generate_xml_rpc_body(method_name, *params) xml = "" xml << "" xml << "#{method_name}" xml << "" params.each do |p| xml << "#{p}" end xml << "" xml << "" return xml end end