Class: CMSScanner::Model::XMLRPC
- Inherits:
-
InterestingFinding
- Object
- InterestingFinding
- CMSScanner::Model::XMLRPC
- 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
Instance Method Summary collapse
- #available_methods ⇒ Array<String>
- #browser ⇒ Browser
-
#enabled? ⇒ Boolean
Whether or not the XMLRPC is enabled.
- #method_call(method_name, method_params = [], request_params = {}) ⇒ Typhoeus::Request
-
#multi_call(methods_and_params = [], request_params = {}) ⇒ Typhoeus::Request
Example of methods_and_params: [ [method1, param1, param2], [method2, param1], [method3] ].
Methods inherited from InterestingFinding
#==, #entries, #initialize, #type
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::Model::InterestingFinding
Instance Method Details
#available_methods ⇒ Array<String>
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/xml_rpc.rb', line 13 def available_methods return @available_methods if @available_methods @available_methods = [] res = method_call('system.listMethods').run doc = Nokogiri::XML.parse(res.body) doc.search('methodResponse params param value array data value string').each do |s| @available_methods << s.text end @available_methods end |
#browser ⇒ Browser
8 9 10 |
# File 'app/models/xml_rpc.rb', line 8 def browser @browser ||= NS::Browser.instance end |
#enabled? ⇒ Boolean
Returns Whether or not the XMLRPC is enabled.
29 30 31 |
# File 'app/models/xml_rpc.rb', line 29 def enabled? !available_methods.empty? end |
#method_call(method_name, method_params = [], request_params = {}) ⇒ Typhoeus::Request
38 39 40 41 42 43 44 45 46 |
# File 'app/models/xml_rpc.rb', line 38 def method_call(method_name, method_params = [], request_params = {}) browser.forge_request( url, request_params.merge( method: :post, body: ::XMLRPC::Create.new.methodCall(method_name, *method_params) ) ) end |
#multi_call(methods_and_params = [], request_params = {}) ⇒ Typhoeus::Request
Example of methods_and_params: [ [method1, param1, param2], [method2, param1], [method3] ]
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/models/xml_rpc.rb', line 59 def multi_call(methods_and_params = [], request_params = {}) browser.forge_request( url, request_params.merge( method: :post, body: ::XMLRPC::Create.new.methodCall( 'system.multicall', methods_and_params.collect { |m| { methodName: m[0], params: m[1..-1] } } ) ) ) end |