From fe822f8d33697a220d33283f3b4a75b7d097d0fb Mon Sep 17 00:00:00 2001 From: Julian Vilas Date: Tue, 10 Mar 2015 00:45:20 +0100 Subject: [PATCH] Modify automatic file cleanup --- .../multi/http/struts_code_exec_classloader.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/exploits/multi/http/struts_code_exec_classloader.rb b/modules/exploits/multi/http/struts_code_exec_classloader.rb index 8a99d5b032..f518cf6009 100644 --- a/modules/exploits/multi/http/struts_code_exec_classloader.rb +++ b/modules/exploits/multi/http/struts_code_exec_classloader.rb @@ -200,11 +200,8 @@ class Metasploit3 < Msf::Exploit::Remote end payload_file = rand_text_alphanumeric(4 + rand(4)) jsp = jsp_dropper(payload_file, payload_exe) - if target['Platform'] == 'win' && target['Arch'] == ARCH_X86 - register_files_for_cleanup("../webapps/ROOT/#{payload_file}") - else - register_files_for_cleanup(payload_file) - end + + register_files_for_cleanup(payload_file) end jsp @@ -274,11 +271,8 @@ class Metasploit3 < Msf::Exploit::Remote fail_with(Failure::Unknown, "#{peer} - The log file hasn't been flushed") end - if target['Platform'] == 'win' && target['Arch'] == ARCH_X86 - register_files_for_cleanup("../webapps/ROOT/#{@jsp_file}") - else - register_files_for_cleanup(@jsp_file) - end + # This path depends on CWD. May require manual cleanup + register_files_for_cleanup("webapps/ROOT/#{@jsp_file}") # Prepare the JSP print_status("#{peer} - Generating JSP...") @@ -308,5 +302,6 @@ class Metasploit3 < Msf::Exploit::Remote } modify_class_loader(properties) end + end