lib/metasploit/aggregator/connection_manager.rb in metasploit-aggregator-0.1.1 vs lib/metasploit/aggregator/connection_manager.rb in metasploit-aggregator-0.1.2
- old
+ new
@@ -13,10 +13,11 @@
def initialize
@cables = []
@manager_mutex = Mutex.new
@router = Router.instance
+ @details_cache = SessionDetailService.instance
end
def self.ssl_generate_certificate
yr = 24*3600*365
vf = Time.at(Time.now.to_i - rand(yr * 3) - yr)
@@ -102,9 +103,26 @@
connections = {}
@cables.each do |cable|
connections = connections.merge cable.forwarder.connections
end
connections
+ end
+
+ def connection_details(payload)
+ detail_map = {}
+ details = @details_cache.session_details(payload)
+ unless details.nil?
+ details.each_pair do |key, value|
+ detail_map[key] = value.to_s
+ end
+ end
+ @cables.each do |cable|
+ next unless cable.forwarder.connections.include?(payload)
+ # TODO: improve how time is exposed for live connections
+ time = cable.forwarder.connection_info(payload)['TIME']
+ detail_map['LAST_SEEN'] = Time.now - time unless time.nil?
+ end
+ detail_map
end
def cables
local_cables = []
@cables.each do |cable|