Update run_as.rb

GSoC/Meterpreter_Web_Console
Auxilus 2018-04-09 21:24:16 +05:30 committed by GitHub
parent c34b796f13
commit c07f2f1a09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,7 @@ class MetasploitModule < Msf::Post
'Description' => %q(
This module will login with the specified username/password and execute the
supplied command as a hidden process. Output is not returned by default, by setting
CMDOUT to false output will be redirected to a temp file and read back in to
CMDOUT to true output will be redirected to a temp file and read back in to
display. By setting advanced option SETPASS to true, it will reset the users
password and then execute the command.
),
@ -89,7 +89,7 @@ class MetasploitModule < Msf::Post
outpath = "#{system_temp}\\#{Rex::Text.rand_text_alpha(8)}.txt"
# Create output file and set permissions so everyone can access
touch(outpath)
touch(outpath) if cmdout
cmdstr = "cmd.exe /c #{cmd}"
cmdstr = "cmd.exe /c #{cmd} > #{outpath}" if cmdout
@ -121,7 +121,9 @@ class MetasploitModule < Msf::Post
vprint_status("Thread Id: #{pi[:thread_id]}")
print_status("Command output:\r\n#{tmpout}") unless tmpout.nil?
end
print_status("Cleaning up...")
print_status("Removing temp file #{outpath}")
rm_f(outpath)
end
end