phpsocks5_log("process 2 {$phpsid}"); set_time_limit(30); phpsocks5_log("process 3 {$phpsid}"); if (!mysql_pconnect("{$dbhost}:{$dbport}", $dbuser, $dbpass)) { phpsocks5_http_500('mysql_pconnect error'); } if (!mysql_select_db($dbname)) { phpsocks5_http_500('mysql_select_db error'); } if (!mysql_query('SET AUTOCOMMIT=1')) { phpsocks5_http_500('mysql_query SET AUTOCOMMIT=1 error'); } phpsocks5_log("process 4 {$phpsid}"); $postdata = file_get_contents("php://input"); phpsocks5_log("process 5 {$phpsid} before decrypt postdata: " . phpsocks5_tohex($postdata)); $postdata = phpsocks5_decrypt($postdata); phpsocks5_log("process 6 {$phpsid} after decrypt postdata: " . phpsocks5_tohex($postdata)); if (!$postdata) { phpsocks5_log("create table process"); $dbversion = 0; if (!mysql_query("SELECT * FROM {$dbprefix}conning")) { $dbversion = 0; } else { $rslt = mysql_query("SELECT * FROM {$dbprefix}dbversion"); if (!$rslt) { $dbversion = 1; } else { $row = mysql_fetch_row($rslt); if (!$row) { if ($debuginfo) { echo 'create table process fetch dbversion row error.';
$remotehost = strtok(':'); $remoteport = strtok(':'); phpsocks5_log("connect process 2"); $local_socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); if (!$local_socket) { phpsocks5_http_500('connect process socket_create error'); } $buf = "{$remotehost}:{$remoteport}"; if (!socket_sendto($local_socket, $buf, strlen(buf), 0, '127.0.0.1', $localport)) { phpsocks5_http_500('connect process socket_sendto error'); } $buf = NULL; if (!socket_recvfrom($local_socket, $buf, 65500, 0, $peer_host, $peer_port)) { phpsocks5_http_500('connect process socket_recvfrom error'); } echo phpsocks5_decrypt($buf); phpsocks5_log("connect process 3"); } elseif ($postdata[2] == "6") { phpsocks5_log("send process 1"); $buf = substr($postdata, 3); $port = strtok($buf, ';'); $buf = substr($buf, strlen($post) + 1); $port = $port / 1; $local_socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); if (!$local_socket) { phpsocks5_http_500('send process socket_create error'); } while (strlen($buf) > 0) { $packet = '1' . substr($buf, 0, 65000); $buf = substr($buf, 65000); if (!socket_sendto($local_socket, $buf, strlen($buf), 0, '127.0.0.1', $port)) {