Class: Arachni::OptionGroups::Dispatcher

Inherits:
Arachni::OptionGroup show all
Defined in:
lib/arachni/option_groups/dispatcher.rb

Overview

Holds options for RPC::Server::Dispatcher servers.

Author:

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

Constant Summary collapse

GRID_MODES =

Returns Supported grid modes.

Returns:

[:balance, :aggregate]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Arachni::OptionGroup

#==, attr_accessor, attributes, #attributes, defaults, #defaults, #hash, inherited, #initialize, #merge, set_defaults, #to_h, #to_hash, #to_rpc_data, #update, #validate

Constructor Details

This class inherits a constructor from Arachni::OptionGroup

Instance Attribute Details

#external_addressString

Returns External (hostname or IP) address for the RPC::Server::Dispatcher to advertise.

Returns:



27
28
29
# File 'lib/arachni/option_groups/dispatcher.rb', line 27

def external_address
  @external_address
end

#grid_modenil, Symbol

Returns Grid mode to use for multi-RPC::Server::Instance scans with interconnected RPC::Server::Dispatchers, available modes are:

  • `nil` – No grid.

  • `:balance` – Default load balancing across available Dispatchers.

  • `:aggregate` – Default load balancing *with* line aggregation.

    Will only request Instances from Grid members with different
    {OptionGroups::Dispatcher#node_pipe_id Pipe-IDs}.
    

Returns:

  • (nil, Symbol)

    Grid mode to use for multi-RPC::Server::Instance scans with interconnected RPC::Server::Dispatchers, available modes are:

    • `nil` – No grid.

    • `:balance` – Default load balancing across available Dispatchers.

    • `:aggregate` – Default load balancing *with* line aggregation.

      Will only request Instances from Grid members with different
      {OptionGroups::Dispatcher#node_pipe_id Pipe-IDs}.
      


48
49
50
# File 'lib/arachni/option_groups/dispatcher.rb', line 48

def grid_mode
  @grid_mode
end

#instance_port_rangeArray<Integer>

Returns Range of ports to use when spawning instances, first entry should be the lowest port number, last the max port number.

Returns:

  • (Array<Integer>)

    Range of ports to use when spawning instances, first entry should be the lowest port number, last the max port number.



37
38
39
# File 'lib/arachni/option_groups/dispatcher.rb', line 37

def instance_port_range
  @instance_port_range
end

#neighbourString

Returns The URL of a neighbouring RPC::Server::Dispatcher, applicable when RPC::Server::Dispatcher are connected to each other to form a Grid.

Returns:

See Also:



55
56
57
# File 'lib/arachni/option_groups/dispatcher.rb', line 55

def neighbour
  @neighbour
end

#node_costFloat

Returns Cost of using this Dispatcher node.

Returns:

  • (Float)

    Cost of using this Dispatcher node.



63
64
65
# File 'lib/arachni/option_groups/dispatcher.rb', line 63

def node_cost
  @node_cost
end

#node_nicknameString

Returns Dispatcher node nickname.

Returns:

  • (String)

    Dispatcher node nickname.



75
76
77
# File 'lib/arachni/option_groups/dispatcher.rb', line 75

def node_nickname
  @node_nickname
end

#node_ping_intervalFloat

Returns How soon to check for #neighbour node status.

Returns:

  • (Float)

    How soon to check for #neighbour node status.



59
60
61
# File 'lib/arachni/option_groups/dispatcher.rb', line 59

def node_ping_interval
  @node_ping_interval
end

#node_pipe_idString

Returns A string identifying the bandwidth pipe used by this Dispatcher node.

Returns:

  • (String)

    A string identifying the bandwidth pipe used by this Dispatcher node.



67
68
69
# File 'lib/arachni/option_groups/dispatcher.rb', line 67

def node_pipe_id
  @node_pipe_id
end

#node_weightFloat

Returns Weight used to calculate the score of this Dispatcher node.

Returns:

  • (Float)

    Weight used to calculate the score of this Dispatcher node.



71
72
73
# File 'lib/arachni/option_groups/dispatcher.rb', line 71

def node_weight
  @node_weight
end

#pool_sizeInteger

Returns Amount of RPC::Server::Instances to keep in the RPC::Server::Dispatcher pool.

Returns:



32
33
34
# File 'lib/arachni/option_groups/dispatcher.rb', line 32

def pool_size
  @pool_size
end

#urlString

Returns URL of a RPC::Server::Dispatcher (used by the UI::CLI::RPC client interface).

Returns:



22
23
24
# File 'lib/arachni/option_groups/dispatcher.rb', line 22

def url
  @url
end

Instance Method Details

#grid=(bool) ⇒ Object

Parameters:

  • bool (Bool)

    `true` to use the Grid, `false` otherwise. Serves as a shorthand to setting #grid_mode to `:balance`.



92
93
94
# File 'lib/arachni/option_groups/dispatcher.rb', line 92

def grid=( bool )
    @grid_mode = bool ? :balance : nil
end

#grid?Bool

Returns `true` if the Grid should be used, `false` otherwise.

Returns:

  • (Bool)

    `true` if the Grid should be used, `false` otherwise.



85
86
87
# File 'lib/arachni/option_groups/dispatcher.rb', line 85

def grid?
    !!@grid_mode
end

#grid_aggregate?Bool

Returns `true` if the grid mode is in line-aggregation mode, `false` otherwise.

Returns:

  • (Bool)

    `true` if the grid mode is in line-aggregation mode, `false` otherwise.



121
122
123
# File 'lib/arachni/option_groups/dispatcher.rb', line 121

def grid_aggregate?
    @grid_mode == :aggregate
end

#grid_balance?Bool

Returns `true` if the grid mode is in load-balancing mode, `false` otherwise.

Returns:

  • (Bool)

    `true` if the grid mode is in load-balancing mode, `false` otherwise.



127
128
129
# File 'lib/arachni/option_groups/dispatcher.rb', line 127

def grid_balance?
    @grid_mode == :balance
end