Use id as non-interactive command in php

This commit is contained in:
Andrea Cardaci 2018-05-30 11:43:17 +02:00
parent bb001f1b8a
commit d937f2ba52

View File

@ -2,22 +2,22 @@
functions: functions:
execute-non-interactive: execute-non-interactive:
- code: | - code: |
export CMD="ls /" export CMD="id"
php -r 'system(getenv("CMD"));' php -r 'system(getenv("CMD"));'
- code: | - code: |
export CMD="ls /" export CMD="id"
php -r 'passthru(getenv("CMD"));' php -r 'passthru(getenv("CMD"));'
- code: | - code: |
export CMD="ls /" export CMD="id"
php -r 'print(shell_exec(getenv("CMD")));' php -r 'print(shell_exec(getenv("CMD")));'
- code: | - code: |
export CMD="ls /" export CMD="id"
php -r '$r=array(); exec(getenv("CMD"), $r); print(join(\"\\n\",$r));' php -r '$r=array(); exec(getenv("CMD"), $r); print(join(\"\\n\",$r));'
- code: | - code: |
export CMD="ls /" export CMD="id"
php -r '$h=@popen(getenv("CMD"),"r"); if($h){ while(!feof($h)) echo(fread($h,4096)); pclose($h); }' php -r '$h=@popen(getenv("CMD"),"r"); if($h){ while(!feof($h)) echo(fread($h,4096)); pclose($h); }'
- code: | - code: |
export CMD="ls /" export CMD="id"
php -r '$p = array(array("pipe","r"),array("pipe","w"),array("pipe", "w"));$h = @proc_open(getenv("CMD"), $p, $pipes);if($h&&$pipes){while(!feof($pipes[1])) echo(fread($pipes[1],4096));while(!feof($pipes[2])) echo(fread($pipes[2],4096));fclose($pipes[0]);fclose($pipes[1]);fclose($pipes[2]);proc_close($h);}' php -r '$p = array(array("pipe","r"),array("pipe","w"),array("pipe", "w"));$h = @proc_open(getenv("CMD"), $p, $pipes);if($h&&$pipes){while(!feof($pipes[1])) echo(fread($pipes[1],4096));while(!feof($pipes[2])) echo(fread($pipes[2],4096));fclose($pipes[0]);fclose($pipes[1]);fclose($pipes[2]);proc_close($h);}'
sudo-enabled: sudo-enabled:
- code: | - code: |