Class: Metasploit::Aggregator::Forwarder

Inherits:
Object
  • Object
show all
Defined in:
lib/metasploit/aggregator/forwarder.rb

Direct Known Subclasses

HttpForwarder, HttpsForwarder

Constant Summary collapse

CONNECTION_TIMEOUT =

one minute

60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeForwarder

Returns a new instance of Forwarder.



9
10
11
12
13
14
# File 'lib/metasploit/aggregator/forwarder.rb', line 9

def initialize
  @log_messages = false
  @response_queues = {}
  @forwarder_mutex = Mutex.new
  @router = Router.instance
end

Instance Attribute Details

#log_messagesObject

Returns the value of attribute log_messages.



6
7
8
# File 'lib/metasploit/aggregator/forwarder.rb', line 6

def log_messages
  @log_messages
end

#response_queuesObject (readonly)

Returns the value of attribute response_queues.



7
8
9
# File 'lib/metasploit/aggregator/forwarder.rb', line 7

def response_queues
  @response_queues
end

Instance Method Details

#connection_info(connection) ⇒ Object



36
37
38
39
40
# File 'lib/metasploit/aggregator/forwarder.rb', line 36

def connection_info(connection)
  info = {}
  info['TIME'] = @response_queues[connection].time unless @response_queues[connection].nil?
  info
end

#connectionsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/metasploit/aggregator/forwarder.rb', line 21

def connections
  # TODO: for now before reporting connections flush stale ones
  flush_stale_sessions
  connections = {}
  @response_queues.each_pair do |connection, queue|
    forward = 'parked'
    send, recv, console = @router.get_forward(connection)
    unless console.nil?
      forward = "#{console}"
    end
    connections[connection] = forward
  end
  connections
end

#forward(connection) ⇒ Object

stub for indexing



17
18
19
# File 'lib/metasploit/aggregator/forwarder.rb', line 17

def forward(connection)

end