Class: CMSScanner::XMLRPC

Inherits:
InterestingFinding show all
Defined in:
app/models/xml_rpc.rb

Overview

XML RPC

Constant Summary

Constants included from Finders::Finding

Finders::Finding::FINDING_OPTS

Instance Attribute Summary

Attributes inherited from InterestingFinding

#to_s, #url

Instance Method Summary collapse

Methods inherited from InterestingFinding

#==, #entries, #initialize

Methods included from Finders::Finding

#<=>, #confidence, #confidence=, #confirmed_by, #eql?, included, #interesting_entries, #parse_finding_options

Constructor Details

This class inherits a constructor from CMSScanner::InterestingFinding

Instance Method Details

#call(method, params = [], request_params = {}) ⇒ Typhoeus::Response

Parameters:

  • method (String)
  • params (Array) (defaults to: [])
  • request_params (Hash) (defaults to: {})

Returns:



9
10
11
# File 'app/models/xml_rpc.rb', line 9

def call(method, params = [], request_params = {})
  NS::Browser.post(url, request_params.merge(body: request_body(method, params)))
end

#request_body(method, params = []) ⇒ String

Might be better to use Nokogiri to create the XML body ?

Parameters:

  • method (String)
  • params (Array) (defaults to: [])

Returns:

  • (String)

    The body of the XML RPC request



19
20
21
22
23
24
25
26
27
28
# File 'app/models/xml_rpc.rb', line 19

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