Path: blob/master/modules/post/multi/general/execute.rb
19592 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post67def initialize(info = {})8super(9update_info(10info,11'Name' => 'Multi Generic Operating System Session Command Execution',12'Description' => %q{ This module executes an arbitrary command line},13'License' => MSF_LICENSE,14'Author' => [ 'hdm' ],15'Platform' => %w[linux osx unix win],16'SessionTypes' => [ 'shell', 'meterpreter' ],17'Notes' => {18'Stability' => [CRASH_SAFE],19'SideEffects' => [],20'Reliability' => []21}22)23)24register_options(25[26OptString.new('COMMAND', [false, 'The entire command line to execute on the session'])27]28)29end3031def run32print_status("Executing #{datastore['COMMAND']} on #{session.inspect}...")33res = cmd_exec(datastore['COMMAND'])34print_status("Response: \n#{res}")35end36end373839