Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/post/multi/general/execute.rb
19592 views
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
'Notes' => {
19
'Stability' => [CRASH_SAFE],
20
'SideEffects' => [],
21
'Reliability' => []
22
}
23
)
24
)
25
register_options(
26
[
27
OptString.new('COMMAND', [false, 'The entire command line to execute on the session'])
28
]
29
)
30
end
31
32
def run
33
print_status("Executing #{datastore['COMMAND']} on #{session.inspect}...")
34
res = cmd_exec(datastore['COMMAND'])
35
print_status("Response: \n#{res}")
36
end
37
end
38
39