Sha256: f6d3d7106db5e4358d7f2798b4368223756014c1b358a5fabd48e152247e78e3

Contents?: true

Size: 1 KB

Versions: 19

Compression:

Stored size: 1 KB

Contents

module CMSScanner
  # XML RPC
  class XMLRPC < InterestingFinding
    # @param [ String ] method
    # @param [ Array ] params
    # @param [ Hash ] request_params
    #
    # @return [ Typhoeus::Response ]
    def call(method, params = [], request_params = {})
      NS::Browser.post(url, request_params.merge(body: request_body(method, params)))
    end

    # Might be better to use Nokogiri to create the XML body ?
    #
    # @param [ String ] method
    # @param [ Array ] params
    #
    # @return [ String ] The body of the XML RPC request
    def request_body(method, params = [])
      p_body = ''

      params.each { |p| p_body << "<param><value><string>#{p}</string></value></param>" }

      body = '<?xml version="1.0"?><methodCall>'
      body << "<methodName>#{method}</methodName>"
      body << "<params>#{p_body}</params>" unless p_body.length.zero?
      body << '</methodCall>'
    end

    # Use the system.listMethods to get the list of available methods ?
    # def entries
    #
    # end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cms_scanner-0.0.39.4 app/models/xml_rpc.rb
cms_scanner-0.0.39.3 app/models/xml_rpc.rb
cms_scanner-0.0.39.2 app/models/xml_rpc.rb
cms_scanner-0.0.39.1 app/models/xml_rpc.rb
cms_scanner-0.0.39.0 app/models/xml_rpc.rb
cms_scanner-0.0.38.4 app/models/xml_rpc.rb
cms_scanner-0.0.38.3 app/models/xml_rpc.rb
cms_scanner-0.0.38.2 app/models/xml_rpc.rb
cms_scanner-0.0.38.1 app/models/xml_rpc.rb
cms_scanner-0.0.38.0 app/models/xml_rpc.rb
cms_scanner-0.0.37.12 app/models/xml_rpc.rb
cms_scanner-0.0.37.11 app/models/xml_rpc.rb
cms_scanner-0.0.37.10 app/models/xml_rpc.rb
cms_scanner-0.0.37.9 app/models/xml_rpc.rb
cms_scanner-0.0.37.8 app/models/xml_rpc.rb
cms_scanner-0.0.37.7 app/models/xml_rpc.rb
cms_scanner-0.0.37.6 app/models/xml_rpc.rb
cms_scanner-0.0.37.5 app/models/xml_rpc.rb
cms_scanner-0.0.37.4 app/models/xml_rpc.rb