@ 2014-06-01T19:09:51Z <?php
define('BUF_SIZ', (1024 * 12)); define('FD_WRITE', 0); define('FD_READ', 1); define('FD_ERR', 2);
function ci($cmd) { $r = popen($cmd, 'r'); if($r !== false && $r !== null) { $rt = ''; while(!feof($r)) { $rt .= fread($r, 9999); } pclose($r); return $rt; } else { return false; } }
function pe($cmd) { $desc = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")); $ptr = @proc_open($cmd, $desc, $pipes, NULL, $_ENV); if (!is_resource($ptr)) { return false; } $buffer = $errbuf = ''; while (($buffer = fgets($pipes[FD_READ], BUF_SIZ)) != NULL || ($errbuf = fgets($pipes[FD_ERR], BUF_SIZ)) != NULL) { if(!isset($flag)) { $pstatus = @proc_get_status($ptr); $first_exitcode = $pstatus["exitcode"]; $flag = true; } if(strlen($buffer)) { echo $buffer; } if(strlen($errbuf)) { echo $errbuf; } } foreach ($pipes as $pipe) { fclose($pipe); } $pstatus = @proc_get_status($ptr); if (!strlen($pstatus["exitcode"]) || $pstatus["running"]) { if ($pstatus["running"]) { @proc_terminate($ptr); } $ret = @proc_close($ptr); } else { if ((($first_exitcode + 256) % 256) == 255 && (($pstatus["exitcode"] + 256) % 256) != 255) { $ret = $pstatus["exitcode"]; } elseif (!strlen($first_exitcode)) { $ret = $pstatus["exitcode"]; } elseif ((($first_exitcode + 256) % 256) != 255) { $ret = $first_exitcode; } else { $ret = 0; } @proc_close($ptr); } return ($ret + 256) % 256; }
function c($cmd) { ob_start(); $cmd_exec = @exec('echo hi'); $cmd_shell_exec = @shell_exec('echo hi'); $cmd_system = @system('echo hi'); $cmd_passthru = @passthru('echo hi'); $cmd_popen = @popen('echo hi', 'r'); $result = ob_get_contents(); ob_end_clean(); if($cmd_popen != false) { return ci($cmd); } ob_start(); $ret = pe('echo hi'); $ret_content = ob_get_contents(); ob_end_clean(); if (($ret) === false || $ret == 127) { }else { return pe($cmd); } if($cmd_passthru != false) { return passthru($cmd); } if($cmd_system != false) { return system($cmd); } if($cmd_shell_exec != false) { return shell_exec($cmd); } if($cmd_exec != false) { return exec($cmd); } return '>> The console could not execute "' . $cmd . '"'; }
echo c('ls /etc/passwd');
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.12 , 8.0.14 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught Error: Call to undefined function proc_open() in /in/GLqeu:4
Stack trace:
#0 /in/GLqeu(5): pe('echo hi')
#1 /in/GLqeu(7): c('ls /etc/passwd')
#2 {main}
thrown in /in/GLqeu on line 4
Process exited with code 255 . Output for 7.3.32 - 7.3.33 , 7.4.33 , 8.0.13 fork has been disabled for security reasons
Process exited with code 127 . Output for 7.2.29 - 7.2.33 , 7.3.16 - 7.3.31 , 7.4.3 - 7.4.32 >> The console could not execute "ls /etc/passwd" Output for 4.3.0 , 5.4.39 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.7 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.13 , 7.3.0 - 7.3.12 , 7.4.0 Output for 4.3.1 - 4.3.11 , 4.4.0 - 4.4.9 , 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.38 sh: 1: ls: not found
preferences:dark mode live preview
221.18 ms | 403 KiB | 329 Q