diff --git a/lib/rex/post/meterpreter/client_core.rb b/lib/rex/post/meterpreter/client_core.rb index df84e63dc7..c7ae95e3e0 100644 --- a/lib/rex/post/meterpreter/client_core.rb +++ b/lib/rex/post/meterpreter/client_core.rb @@ -100,6 +100,18 @@ class ClientCore < Extension commands end + def get_transport_timeouts + request = Packet.create_request('core_transport_get_timeouts') + response = client.send_request(request) + + { + :session_exp => response.get_tlv_value(TLV_TYPE_TRANS_SESSION_EXP), + :comm_timeout => response.get_tlv_value(TLV_TYPE_TRANS_COMM_TIMEOUT), + :retry_total => response.get_tlv_value(TLV_TYPE_TRANS_RETRY_TOTAL), + :retry_wait => response.get_tlv_value(TLV_TYPE_TRANS_RETRY_WAIT) + } + end + # # Loads a library on the remote meterpreter instance. This method # supports loading both extension and non-extension libraries and diff --git a/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb b/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb index 609b150dbe..256393359d 100644 --- a/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb +++ b/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb @@ -1,5 +1,6 @@ # -*- coding: binary -*- require 'set' +require 'dotiw' require 'rex/post/meterpreter' require 'rex/parser/arguments' @@ -58,6 +59,7 @@ class Console::CommandDispatcher::Core "run" => "Executes a meterpreter script or Post module", "bgrun" => "Executes a meterpreter script as a background thread", "bgkill" => "Kills a background meterpreter script", + "get_timeouts" => "Kills a background meterpreter script", "bglist" => "Lists running background scripts", "write" => "Writes data to a channel", "enable_unicode_encoding" => "Enables encoding of unicode strings", @@ -322,6 +324,14 @@ class Console::CommandDispatcher::Core Rex::Ui::Text::IrbShell.new(binding).run end + def cmd_get_timeouts(*args) + timeouts = client.core.get_transport_timeouts + print_line("Session Expiry : @ #{(Time.now + timeouts[:session_exp]).strftime('%Y-%m-%d %H:%M:%S')}") + print_line("Comm Timeout : #{timeouts[:comm_timeout]} seconds") + print_line("Retry Total Time: #{timeouts[:retry_total]} seconds") + print_line("Retry Wait Time : #{timeouts[:retry_wait]} seconds") + end + # # Get the machine ID of the target #