CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/post/multi/general/execute.rb
Views: 11784
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Post
7
8
def initialize(info = {})
9
super(
10
update_info(
11
info,
12
'Name' => 'Multi Generic Operating System Session Command Execution',
13
'Description' => %q{ This module executes an arbitrary command line},
14
'License' => MSF_LICENSE,
15
'Author' => [ 'hdm' ],
16
'Platform' => %w[linux osx unix win],
17
'SessionTypes' => [ 'shell', 'meterpreter' ]
18
)
19
)
20
register_options(
21
[
22
OptString.new('COMMAND', [false, 'The entire command line to execute on the session'])
23
]
24
)
25
end
26
27
def run
28
print_status("Executing #{datastore['COMMAND']} on #{session.inspect}...")
29
res = cmd_exec(datastore['COMMAND'])
30
print_status("Response: \n#{res}")
31
end
32
end
33
34