Class: Arachni::RPC::XML::Client::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rpc/xml/client/base.rb

Overview

Basic self-configuring XMLRPC client supporting cert-based SSL client/server authentication

@author: Tasos “Zapotek” Laskos

<[email protected]>
<[email protected]>

@version: 0.1

Direct Known Subclasses

Dispatcher, Instance

Instance Method Summary collapse

Constructor Details

#initialize(opts, url) ⇒ Base

Returns a new instance of Base.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rpc/xml/client/base.rb', line 29

def initialize( opts, url )

    @opts = opts

    # start the XMLRPC client
    @server = ::XMLRPC::Client.new2( url )

    # there'll be a HELL of lot of output so things might get..laggy.
    # a big timeout is required to avoid Timeout exceptions...
    @server.timeout = 9999999


    if @opts.ssl_ca || @opts.ssl_pkey || @opts.ssl_cert

        pkey = ::OpenSSL::PKey::RSA.new( File.read( opts.ssl_pkey ) )         if @opts.ssl_pkey
        cert = ::OpenSSL::X509::Certificate.new( File.read( opts.ssl_cert ) ) if @opts.ssl_cert

        @server.instance_variable_get( :@http ).instance_variable_set( :@key, pkey )
        @server.instance_variable_get( :@http ).instance_variable_set( :@cert, cert )

        @server.instance_variable_get( :@http ).instance_variable_set( :@ca_file, @opts.ssl_ca )
        @server.instance_variable_get( :@http ).instance_variable_set( :@verify_mode,
            OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT )

    else
        @server.instance_variable_get( :@http ).instance_variable_set( :@verify_mode, OpenSSL::SSL::VERIFY_NONE )
    end

end

Instance Method Details

#call(method, *args) ⇒ Object

Used to make old school XMLRPC calls



62
63
64
# File 'lib/rpc/xml/client/base.rb', line 62

def call( method, *args )
    @server.call( method, *args )
end