Skip to content

Commit ec7fab7

Browse files
committed
Add support for getting transport timeouts
1 parent 91202e2 commit ec7fab7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/rex/post/meterpreter/client_core.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ def get_loaded_extension_commands(extension_name)
100100
commands
101101
end
102102

103+
def get_transport_timeouts
104+
request = Packet.create_request('core_transport_get_timeouts')
105+
response = client.send_request(request)
106+
107+
{
108+
:session_exp => response.get_tlv_value(TLV_TYPE_TRANS_SESSION_EXP),
109+
:comm_timeout => response.get_tlv_value(TLV_TYPE_TRANS_COMM_TIMEOUT),
110+
:retry_total => response.get_tlv_value(TLV_TYPE_TRANS_RETRY_TOTAL),
111+
:retry_wait => response.get_tlv_value(TLV_TYPE_TRANS_RETRY_WAIT)
112+
}
113+
end
114+
103115
#
104116
# Loads a library on the remote meterpreter instance. This method
105117
# supports loading both extension and non-extension libraries and

lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: binary -*-
22
require 'set'
3+
require 'dotiw'
34
require 'rex/post/meterpreter'
45
require 'rex/parser/arguments'
56

@@ -58,6 +59,7 @@ def commands
5859
"run" => "Executes a meterpreter script or Post module",
5960
"bgrun" => "Executes a meterpreter script as a background thread",
6061
"bgkill" => "Kills a background meterpreter script",
62+
"get_timeouts" => "Kills a background meterpreter script",
6163
"bglist" => "Lists running background scripts",
6264
"write" => "Writes data to a channel",
6365
"enable_unicode_encoding" => "Enables encoding of unicode strings",
@@ -322,6 +324,14 @@ def cmd_irb(*args)
322324
Rex::Ui::Text::IrbShell.new(binding).run
323325
end
324326

327+
def cmd_get_timeouts(*args)
328+
timeouts = client.core.get_transport_timeouts
329+
print_line("Session Expiry : @ #{(Time.now + timeouts[:session_exp]).strftime('%Y-%m-%d %H:%M:%S')}")
330+
print_line("Comm Timeout : #{timeouts[:comm_timeout]} seconds")
331+
print_line("Retry Total Time: #{timeouts[:retry_total]} seconds")
332+
print_line("Retry Wait Time : #{timeouts[:retry_wait]} seconds")
333+
end
334+
325335
#
326336
# Get the machine ID of the target
327337
#

0 commit comments

Comments
 (0)