Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/msf/base/sessions/meterpreter_options.rb
Views: 11784
# -*- coding: binary -*-12require 'shellwords'34module Msf5module Sessions6#7# Defines common options across all Meterpreter implementations8#9module MeterpreterOptions1011TIMEOUT_SESSION = 24 * 3600 * 7 # 1 week12TIMEOUT_COMMS = 300 # 5 minutes13TIMEOUT_RETRY_TOTAL = 60 * 60 # 1 hour14TIMEOUT_RETRY_WAIT = 10 # 10 seconds1516def initialize(info = {})17super(info)1819register_advanced_options(20[21OptBool.new(22'AutoLoadStdapi',23[true, "Automatically load the Stdapi extension", true]24),25OptInt.new(26'AutoVerifySessionTimeout',27[false, "Timeout period to wait for session validation to occur, in seconds", 30]28),29OptString.new(30'InitialAutoRunScript',31[false, "An initial script to run on session creation (before AutoRunScript)", '']32),33OptString.new(34'AutoRunScript',35[false, "A script to run automatically on session creation.", '']36),37OptBool.new(38'AutoSystemInfo',39[true, "Automatically capture system information on initialization.", true]40),41OptBool.new(42'EnableUnicodeEncoding',43[true, "Automatically encode UTF-8 strings as hexadecimal", Rex::Compat.is_windows]44),45OptPath.new(46'HandlerSSLCert',47[false, "Path to a SSL certificate in unified PEM format, ignored for HTTP transports"]48),49OptInt.new(50'SessionRetryTotal',51[false, "Number of seconds try reconnecting for on network failure", TIMEOUT_RETRY_TOTAL]52),53OptInt.new(54'SessionRetryWait',55[false, "Number of seconds to wait between reconnect attempts", TIMEOUT_RETRY_WAIT]56),57OptInt.new(58'SessionExpirationTimeout',59[ false, 'The number of seconds before this session should be forcibly shut down', TIMEOUT_SESSION]60),61OptInt.new(62'SessionCommunicationTimeout',63[ false, 'The number of seconds of no activity before this session should be killed', TIMEOUT_COMMS]64),65OptString.new(66'PayloadProcessCommandLine',67[ false, 'The displayed command line that will be used by the payload', '']68),69OptBool.new(70'AutoUnhookProcess',71[true, "Automatically load the unhook extension and unhook the process", false]72),73OptBool.new(74'MeterpreterDebugBuild',75[false, 'Use a debug version of Meterpreter']76),77OptMeterpreterDebugLogging.new(78'MeterpreterDebugLogging',79[false, 'The Meterpreter debug logging configuration, see https://docs.metasploit.com/docs/using-metasploit/advanced/meterpreter/meterpreter-debugging-meterpreter-sessions.html']80)81],82self.class83)84end8586def meterpreter_logging_config(opts = {})87ds = opts[:datastore] || datastore88{89debug_build: (ds[:debug_build] || datastore['MeterpreterDebugBuild']),90log_path: (ds[:log_path] || parse_rpath)91}92end9394def mettle_logging_config(opts = {})95ds = opts[:datastore] || datastore96debug_build = ds[:debug_build] || datastore['MeterpreterDebugBuild']97log_path = ds[:log_path] || parse_rpath98{99debug: debug_build ? 3 : 0,100log_file: log_path101}102end103104private105106def parse_rpath107Msf::OptMeterpreterDebugLogging.parse_logging_options(datastore['MeterpreterDebugLogging'])[:rpath]108end109end110end111end112113114