Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for SourceGuardian & phpSHIELD)
- *
- * @ Version : 1.1.5.0
- * @ Author : DeZender
- * @ Release on : 09.06.2012
- * @ Official site : http://DeZender.Net
- *
- */
- function multi_thread($proxies) {
- global $async_connect_timeout;
- global $sub_process;
- global $debug_mode;
- $status = array( );
- $sockets = array( );
- if (( !is_array( $proxies ) || count( $proxies ) < 1 )) {
- return false;
- }
- $id = 0;
- foreach ($proxies as $proxy) {
- $id = ;
- $proxy = trim( $proxy );
- $tmp = explode( ':', $proxy );
- $ipaddr = $tmp[0];
- $port = $tmp[1];
- $s = non_blocking_connect( $ipaddr, $port, $errno = '', $errstr = '', $async_connect_timeout );
- if ($s) {
- $sockets[$id] = $s;
- }
- usleep( 5000 );
- }
- while (count( $sockets )) {
- $read = $write = $sockets;
- $n = socket_select( $read = null, $write, $_e = null, 0, $async_connect_timeout );
- if ($n === false) {
- break;
- }
- if (0 < $n) {
- foreach ($write as $w) {
- $id = array_search( $w, $sockets );
- $str = '';
- @socket_set_option( $w, SOL_SOCKET, SO_SNDTIMEO, array( 'sec' => 0, 'usec' => 0 ) );
- $sent = @socket_write( $w, $str, 1 );
- if ($sent === false) {
- $errno = socket_last_error( $w );
- $errstr = socket_strerror( $errno );
- $status[$id] = ( . '[' ) . $errno . '] ' . $errstr;
- } else {
- $status[$id] = 'OK';
- }
- socket_close( $w );
- unset( $sockets[$id] );
- }
- } else {
- $id = 0;
- foreach ($sockets as $s) {
- $id = ;
- $status[$id] = 'timed out';
- }
- break;
- }
- }
- $sub_process = array( );
- $id = 0;
- foreach ($proxies as $proxy) {
- $id = ;
- $proxy = trim( $proxy );
- if ($debug_mode == 'Y') {
- echo ( . 'connect() ' . $proxy . ' ' ) . $status[$id] . '<br>';
- ob_flush( );
- flush( );
- }
- if ($status[$id] == 'OK') {
- $sub_process[] = $proxy;
- }
- }
- return $sub_process;
- }
- function non_blocking_connect($ip, &$port, &$errno, $errstr, $async_connect_timeout) {
- $sock = socket_create( AF_INET, SOCK_STREAM, 6 );
- if (socket_set_nonblock( $sock )) {
- socket_set_option( $sock, SOL_SOCKET, SO_SNDTIMEO, array( 'sec' => 0, 'usec' => $async_connect_timeout ) );
- $s = @socket_connect( $sock, $ip, $port );
- if (( $s || socket_last_error( ) == EINPROGRESS )) {
- $errno = EINPROGRESS;
- return $sock;
- }
- }
- $errno = socket_last_error( $sock );
- $errstr = socket_strerror( $errno );
- socket_close( $sock );
- return false;
- }
- ...............................................................
- ....................................
- .............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement