retab exec_powershell.rb

bug/bundler_fix
RageLtMan 2015-05-20 19:08:50 -04:00
parent 27e12754fe
commit 6d9f6c9715
1 changed files with 33 additions and 33 deletions

View File

@ -10,52 +10,52 @@ require 'rex'
require 'msf/core/post/windows/powershell' require 'msf/core/post/windows/powershell'
class Metasploit3 < Msf::Post class Metasploit3 < Msf::Post
include Msf::Post::Windows::Powershell include Msf::Post::Windows::Powershell
def initialize(info={}) def initialize(info={})
super(update_info(info, super(update_info(info,
'Name' => "Windows Powershell Execution Post Module", 'Name' => "Windows Powershell Execution Post Module",
'Description' => %q{ 'Description' => %q{
This module will execute a powershell script in a meterpreter session. This module will execute a powershell script in a meterpreter session.
The user may also enter text substitutions to be made in memory before execution. The user may also enter text substitutions to be made in memory before execution.
Setting VERBOSE to true will output both the script prior to execution and the results. Setting VERBOSE to true will output both the script prior to execution and the results.
}, },
'License' => MSF_LICENSE, 'License' => MSF_LICENSE,
'Platform' => ['windows'], 'Platform' => ['windows'],
'SessionTypes' => ['meterpreter'], 'SessionTypes' => ['meterpreter'],
'Author' => [ 'Author' => [
'Nicholas Nam (nick[at]executionflow.org)', # original meterpreter script 'Nicholas Nam (nick[at]executionflow.org)', # original meterpreter script
'RageLtMan' # post module and libs 'RageLtMan' # post module and libs
] ]
)) ))
register_options( register_options(
[ [
OptString.new( 'SCRIPT', [true, 'Path to the PS script or command string to execute' ]), OptString.new( 'SCRIPT', [true, 'Path to the PS script or command string to execute' ]),
], self.class) ], self.class)
register_advanced_options( register_advanced_options(
[ [
OptString.new('SUBSTITUTIONS', [false, 'Script subs in gsub format - original,sub;original,sub' ]), OptString.new('SUBSTITUTIONS', [false, 'Script subs in gsub format - original,sub;original,sub' ]),
], self.class) ], self.class)
end end
def run def run
# Make sure we meet the requirements before running the script, note no need to return # Make sure we meet the requirements before running the script, note no need to return
# unless error # unless error
raise "Powershell not available" if ! have_powershell? raise "Powershell not available" if ! have_powershell?
# Preprocess the Powershell::Script object with substitions from Exploit::Powershell # Preprocess the Powershell::Script object with substitions from Exploit::Powershell
script = make_subs(read_script(datstore['SCRIPT']),process_subs(datstore['SUBSTITUTIONS'])) script = make_subs(read_script(datstore['SCRIPT']),process_subs(datstore['SUBSTITUTIONS']))
# Execute in session # Execute in session
print_status psh_exec(script) print_status psh_exec(script)
print_good('Finished!') print_good('Finished!')
end end