move client core constants closer to where they are actually used
parent
5b579baa33
commit
d8ee4150e6
|
@ -3,30 +3,74 @@
|
|||
require 'shellwords'
|
||||
|
||||
module Msf
|
||||
module Sessions
|
||||
module MeterpreterOptions
|
||||
module Sessions
|
||||
#
|
||||
# Defines common options across all Meterpreter implementations
|
||||
#
|
||||
module MeterpreterOptions
|
||||
|
||||
def initialize(info = {})
|
||||
super(info)
|
||||
TIMEOUT_SESSION = 24 * 3600 * 7 # 1 week
|
||||
TIMEOUT_COMMS = 300 # 5 minutes
|
||||
TIMEOUT_RETRY_TOTAL = 60 * 60 # 1 hour
|
||||
TIMEOUT_RETRY_WAIT = 10 # 10 seconds
|
||||
|
||||
register_advanced_options(
|
||||
[
|
||||
OptBool.new('AutoLoadStdapi', [true, "Automatically load the Stdapi extension", true]),
|
||||
OptBool.new('AutoVerifySession', [true, "Automatically verify and drop invalid sessions", true]),
|
||||
OptInt.new('AutoVerifySessionTimeout', [false, "Timeout period to wait for session validation to occur, in seconds", 30]),
|
||||
OptString.new('InitialAutoRunScript', [false, "An initial script to run on session creation (before AutoRunScript)", '']),
|
||||
OptString.new('AutoRunScript', [false, "A script to run automatically on session creation.", '']),
|
||||
OptBool.new('AutoSystemInfo', [true, "Automatically capture system information on initialization.", true]),
|
||||
OptBool.new('EnableUnicodeEncoding', [true, "Automatically encode UTF-8 strings as hexadecimal", Rex::Compat.is_windows]),
|
||||
OptPath.new('HandlerSSLCert', [false, "Path to a SSL certificate in unified PEM format, ignored for HTTP transports"]),
|
||||
OptInt.new('SessionRetryTotal', [false, "Number of seconds try reconnecting for on network failure", Rex::Post::Meterpreter::ClientCore::TIMEOUT_RETRY_TOTAL]),
|
||||
OptInt.new('SessionRetryWait', [false, "Number of seconds to wait between reconnect attempts", Rex::Post::Meterpreter::ClientCore::TIMEOUT_RETRY_WAIT]),
|
||||
OptInt.new('SessionExpirationTimeout', [ false, 'The number of seconds before this session should be forcibly shut down', Rex::Post::Meterpreter::ClientCore::TIMEOUT_SESSION]),
|
||||
OptInt.new('SessionCommunicationTimeout', [ false, 'The number of seconds of no activity before this session should be killed', Rex::Post::Meterpreter::ClientCore::TIMEOUT_COMMS])
|
||||
], self.class)
|
||||
def initialize(info = {})
|
||||
super(info)
|
||||
|
||||
register_advanced_options(
|
||||
[
|
||||
OptBool.new(
|
||||
'AutoLoadStdapi',
|
||||
[true, "Automatically load the Stdapi extension", true]
|
||||
),
|
||||
OptBool.new(
|
||||
'AutoVerifySession',
|
||||
[true, "Automatically verify and drop invalid sessions", true]
|
||||
),
|
||||
OptInt.new(
|
||||
'AutoVerifySessionTimeout',
|
||||
[false, "Timeout period to wait for session validation to occur, in seconds", 30]
|
||||
),
|
||||
OptString.new(
|
||||
'InitialAutoRunScript',
|
||||
[false, "An initial script to run on session creation (before AutoRunScript)", '']
|
||||
),
|
||||
OptString.new(
|
||||
'AutoRunScript',
|
||||
[false, "A script to run automatically on session creation.", '']
|
||||
),
|
||||
OptBool.new(
|
||||
'AutoSystemInfo',
|
||||
[true, "Automatically capture system information on initialization.", true]
|
||||
),
|
||||
OptBool.new(
|
||||
'EnableUnicodeEncoding',
|
||||
[true, "Automatically encode UTF-8 strings as hexadecimal", Rex::Compat.is_windows]
|
||||
),
|
||||
OptPath.new(
|
||||
'HandlerSSLCert',
|
||||
[false, "Path to a SSL certificate in unified PEM format, ignored for HTTP transports"]
|
||||
),
|
||||
OptInt.new(
|
||||
'SessionRetryTotal',
|
||||
[false, "Number of seconds try reconnecting for on network failure", TIMEOUT_RETRY_TOTAL]
|
||||
),
|
||||
OptInt.new(
|
||||
'SessionRetryWait',
|
||||
[false, "Number of seconds to wait between reconnect attempts", TIMEOUT_RETRY_WAIT]
|
||||
),
|
||||
OptInt.new(
|
||||
'SessionExpirationTimeout',
|
||||
[ false, 'The number of seconds before this session should be forcibly shut down', TIMEOUT_SESSION]
|
||||
),
|
||||
OptInt.new(
|
||||
'SessionCommunicationTimeout',
|
||||
[ false, 'The number of seconds of no activity before this session should be killed', TIMEOUT_COMMS]
|
||||
)
|
||||
],
|
||||
self.class
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -34,11 +34,6 @@ module Meterpreter
|
|||
###
|
||||
class ClientCore < Extension
|
||||
|
||||
TIMEOUT_SESSION = 24*3600*7 # 1 week
|
||||
TIMEOUT_COMMS = 300 # 5 minutes
|
||||
TIMEOUT_RETRY_TOTAL = 60*60 # 1 hour
|
||||
TIMEOUT_RETRY_WAIT = 10 # 10 seconds
|
||||
|
||||
VALID_TRANSPORTS = [
|
||||
'reverse_tcp',
|
||||
'reverse_http',
|
||||
|
|
Loading…
Reference in New Issue