Sha256: f84fded03dbc71560a3f79bab562299d7c88d29b8d5eaf65ff9a32d64d69a2eb
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
module Metasploit module Aggregator class Forwarder CONNECTION_TIMEOUT = 60 # one minute attr_accessor :log_messages attr_reader :response_queues def initialize @log_messages = false @response_queues = {} @forwarder_mutex = Mutex.new @router = Router.instance end # stub for indexing def forward(connection) end 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 def connection_info(connection) info = {} info['TIME'] = @response_queues[connection].time unless @response_queues[connection].nil? info end def flush_stale_sessions @forwarder_mutex.synchronize do stale_sessions = [] @response_queues.each_pair do |payload, queue| unless (queue.time + CONNECTION_TIMEOUT) > Time.now stale_sessions << payload end end stale_sessions.each do |payload| stale_queue = @response_queues.delete(payload) stale_queue.stop_processing unless stale_queue.nil? end end end private :flush_stale_sessions end end end
Version data entries
4 entries across 4 versions & 1 rubygems