metasploit-framework/modules/post/multi/general/execute.rb

30 lines
898 B
Ruby
Raw Normal View History

##
2017-07-24 13:26:21 +00:00
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Post
2013-09-05 18:41:25 +00:00
def initialize(info={})
super( update_info( info,
'Name' => 'Multi Generic Operating System Session Command Execution',
'Description' => %q{ This module executes an arbitrary command line},
'License' => MSF_LICENSE,
'Author' => [ 'hdm' ],
'Platform' => %w{ linux osx unix win },
2013-09-05 18:41:25 +00:00
'SessionTypes' => [ 'shell', 'meterpreter' ]
))
register_options(
[
OptString.new( 'COMMAND', [false, 'The entire command line to execute on the session'])
])
2013-09-05 18:41:25 +00:00
end
2013-08-30 21:28:54 +00:00
def run
print_status("Executing #{datastore['COMMAND']} on #{session.inspect}...")
res = cmd_exec(datastore['COMMAND'])
print_status("Response: #{res}")
2012-05-01 22:29:27 +00:00
2013-08-30 21:28:54 +00:00
end
end