Class: Arachni::RPC::XML::Server::Base

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

Overview

Dispatcher class

@author: Tasos “Zapotek” Laskos

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

@version: 0.1

Direct Known Subclasses

Dispatcher, Instance

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ 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
# File 'lib/rpc/xml/server/base.rb', line 29

def initialize( opts )

    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

    if opts.ssl_pkey || opts.ssl_cert || opts.ssl_ca
        verification = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
    else
        verification = ::OpenSSL::SSL::VERIFY_NONE
    end

    @server = ::WEBrick::HTTPServer.new(
        :Port            => opts.rpc_port,
        :SSLEnable       => opts.ssl  || false,
        :SSLVerifyClient => verification,
        :SSLCertName     => [ [ "CN", ::WEBrick::Utils::getservername ] ],
        :SSLCertificate  => cert,
        :SSLPrivateKey   => pkey,
        :SSLCACertificateFile => opts.ssl_ca
    )

    print_status( 'Initing XMLRPC Server...' )
    @service = ::XMLRPC::WEBrickServlet.new(  )
    @service.add_introspection
    @server.mount( "/RPC2", @service )
end

Instance Method Details

#add_handler(name, klass) ⇒ Object



56
57
58
# File 'lib/rpc/xml/server/base.rb', line 56

def add_handler( name, klass )
    @service.add_handler( ::XMLRPC::iPIMethods( name ), klass )
end

#alive?Boolean Also known as: is_alive

Returns:

  • (Boolean)


64
65
66
# File 'lib/rpc/xml/server/base.rb', line 64

def alive?
    return true
end

#runObject



60
61
62
# File 'lib/rpc/xml/server/base.rb', line 60

def run
    @server.start
end

#shutdownObject



69
70
71
# File 'lib/rpc/xml/server/base.rb', line 69

def shutdown
    @server.shutdown
end