Skip to content

Commit 252b573

Browse files
author
Brent Cook
committed
Land rapid7#5547, configurable auto session timeout
2 parents 0b0cc36 + 9dbdaf1 commit 252b573

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/msf/base/sessions/meterpreter_options.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def initialize(info = {})
1313
[
1414
OptBool.new('AutoLoadStdapi', [true, "Automatically load the Stdapi extension", true]),
1515
OptBool.new('AutoVerifySession', [true, "Automatically verify and drop invalid sessions", true]),
16+
OptInt.new('AutoVerifySessionTimeout', [false, "Timeout period to wait for session validation to occur, in seconds", 10]),
1617
OptString.new('InitialAutoRunScript', [false, "An initial script to run on session creation (before AutoRunScript)", '']),
1718
OptString.new('AutoRunScript', [false, "A script to run automatically on session creation.", '']),
1819
OptBool.new('AutoSystemInfo', [true, "Automatically capture system information on initialization.", true]),
@@ -43,7 +44,7 @@ def on_session(session)
4344
valid = true
4445

4546
if datastore['AutoVerifySession'] == true
46-
if not session.is_valid_session?
47+
if not session.is_valid_session?(datastore['AutoVerifySessionTimeout'].to_i)
4748
print_error("Meterpreter session #{session.sid} is not valid and will be closed")
4849
valid = false
4950
end

0 commit comments

Comments
 (0)