Module: Arachni::RPC::Server::Framework::Distributor

Included in:
MultiInstance
Defined in:
lib/arachni/rpc/server/framework/distributor.rb

Overview

Contains utility methods used to connect to instances and dispatchers and split and distribute the workload.

Author:

Constant Summary collapse

MAX_CONCURRENCY =

Maximum concurrency when communicating with instances.

Means that you should connect to MAX_CONCURRENCY instances at a time while iterating through them.

20
MIN_PAGES_PER_INSTANCE =

Minimum pages per instance.

Prevents slaves from having fewer than MIN_PAGES_PER_INSTANCE pages each, the last slave could of course have less than that if the page count isn’t a multiple of MIN_PAGES_PER_INSTANCE.

1

Instance Method Summary collapse

Instance Method Details

#connect_to_instance(instance) ⇒ Object

Connects to a remote Instance.

the `'token'` can be omitted.

Parameters:

  • instance (Hash)

    The hash must hold the ‘’url’‘ and the `’token’‘. In subsequent calls



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/arachni/rpc/server/framework/distributor.rb', line 52

def connect_to_instance( instance )
    instance = instance.symbolize_keys
    @instance_connections ||= {}

    if @instance_connections[instance[:url]]
        return @instance_connections[instance[:url]]
    end

    @tokens ||= {}
    @tokens[instance[:url]] = instance[:token] if instance[:token]
    @instance_connections[instance[:url]] =
        RPC::Client::Instance.new( @opts, instance[:url], @tokens[instance[:url]] )
end