class Arachni::RPC::Client::Instance

RPC client for remote instances spawned by a remote dispatcher

@author Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>

Attributes

checks[R]
framework[R]
options[R]
plugins[R]
service[R]

Public Class Methods

new( options, url, token = nil ) click to toggle source
# File lib/arachni/rpc/client/instance.rb, line 54
def initialize( options, url, token = nil )
    @token  = token
    @client = Base.new( options, url, token )

    @framework = Framework.new( @client )
    @service   = Service.new( @client )

    @options   = Proxy.new( @client, 'options' )
    @checks    = Proxy.new( @client, 'checks' )
    @plugins   = Proxy.new( @client, 'plugins' )
end
when_ready( url, token, &block ) click to toggle source
# File lib/arachni/rpc/client/instance.rb, line 31
def when_ready( url, token, &block )
    options     = OpenStruct.new
    options.rpc = OpenStruct.new( Arachni::Options.to_h[:rpc] )
    options.rpc.client_max_retries   = 0
    options.rpc.connection_pool_size = 1

    client = new( options, url, token )
    Reactor.global.delay( 0.1 ) do |task|
        client.service.alive? do |r|
            if r.rpc_exception?
                Reactor.global.delay( 0.1, &task )
                next
            end

            client.close

            block.call
        end
    end
end

Public Instance Methods

close() click to toggle source
# File lib/arachni/rpc/client/instance.rb, line 74
def close
    @client.close
end
token() click to toggle source
# File lib/arachni/rpc/client/instance.rb, line 70
def token
    @token
end
url() click to toggle source
# File lib/arachni/rpc/client/instance.rb, line 78
def url
    @client.url
end
when_ready( &block ) click to toggle source
# File lib/arachni/rpc/client/instance.rb, line 66
def when_ready( &block )
    self.class.when_ready( url, token, &block )
end