Class: Arachni::RPC::Client::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/rpc/client/dispatcher.rb

Overview

RPC Dispatcher client

Author:

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, url) ⇒ Dispatcher

Returns a new instance of Dispatcher.



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/arachni/rpc/client/dispatcher.rb', line 23

def initialize( opts, url )
    @client = Base.new( opts, url )
    @node   = Proxy.new( @client, 'node' )

    # map Dispatcher handlers
    Dir.glob( "#{Options.paths.services}*.rb" ).each do |handler|
        name = File.basename( handler, '.rb' )

        self.class.send( :attr_reader, name.to_sym )
        instance_variable_set( "@#{name}".to_sym, Proxy.new( @client, name ) )
    end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object (private)

Used to provide the illusion of locality for remote methods



47
48
49
# File 'lib/arachni/rpc/client/dispatcher.rb', line 47

def method_missing( sym, *args, &block )
    @client.call( "dispatcher.#{sym.to_s}", *args, &block )
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



21
22
23
# File 'lib/arachni/rpc/client/dispatcher.rb', line 21

def node
  @node
end

Instance Method Details

#closeObject



40
41
42
# File 'lib/arachni/rpc/client/dispatcher.rb', line 40

def close
    @client.close
end

#urlObject



36
37
38
# File 'lib/arachni/rpc/client/dispatcher.rb', line 36

def url
    @client.url
end