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/command_shell_options.rb
Views: 11784
# -*- coding: binary -*-12##3# This file is part of the Metasploit Framework and may be subject to4# redistribution and commercial restrictions. Please see the Metasploit5# Framework web site for more information on licensing and terms of use.6# https://metasploit.com/framework/7##8910module Msf11module Sessions12module CommandShellOptions1314def initialize(info = {})15super(info)1617register_advanced_options(18[19OptString.new('InitialAutoRunScript', "An initial script to run on session creation (before AutoRunScript)"),20OptString.new('AutoRunScript', "A script to run automatically on session creation."),21OptString.new('CommandShellCleanupCommand', "A command to run before the session is closed"),22OptBool.new('AutoVerifySession', [true, 'Automatically verify and drop invalid sessions', true])23]24)25end2627def on_session(session)28super2930# Configure input/output to match the payload31session.user_input = self.user_input if self.user_input32session.user_output = self.user_output if self.user_output3334platform = nil35if self.platform and self.platform.kind_of? Msf::Module::PlatformList36platform = self.platform.platforms.first.realname.downcase37end38if self.platform and self.platform.kind_of? Msf::Module::Platform39platform = self.platform.realname.downcase40end414243# a blank platform is *all* platforms and used by the generic modules, in that case only set this instance if it was44# not previously set to a more specific value through some means45session.platform = platform unless platform.blank? && !session.platform.blank?4647if self.arch48if self.arch.kind_of?(Array)49session.arch = self.arch.join('')50else51session.arch = self.arch52end53end5455end5657end58end59end606162