Proxy Checker = Что за трабла с чтением ?

Nitrex

Guest
Proxy Checker = Что за трабла с чтением ?

Re all
Вообщем имеется скрипт:
<?
set_time_limit(10);
$socks=file("socks.txt");
$timeout=8;
for ($i=0;$i<count($socks);$i++)
{
$t=explode(":",$socks[$i]);
$t2=explode("\n",$socks[$i]);
$ip=$t[0];
$port=$t[1];

if(!fsockopen($ip,$port,$errno,$errstr,$timeout))
echo "$socks[$i] - This is Suxx!<br>";
else echo "$socks[$i] - Good<br>";
}
?>
Он чекает прокси,ну так вот прикол в том что если в файле есть только хорошие проксики то он их выводит,а если же в файле есть какой-то дохлый проксик то скрипт вообще ничего не выводит :eek: :eek: :confused:
В чем проблема и как ее исправить?
P.S thx
 

Astral Man

We Will Rock You
Re: Proxy Checker = Что за трабла с чтением ?

Вывод ошибок E_ALL стоит?
 

nerezus

Вселенский отказник
PHP:
<?

//PHP socks proxyhunter by nerezus(ICQ 547097), 2005, GPL v.2

$from =$_GET['from'];
$to =$_GET['to'];
$pfrom =$_GET['pfrom'];
$pto =$_GET['pto'];
$outfile =$_GET['outfile'];
$timeout =$_GET['timeout'];
if ($outfile=='') $outfile='out.txt';
if ($timeout=='') $timeout=3;


function hex2bin($dump){
$dump=str_replace(' ', '', $dump);
$res='';
$dumplen=strlen($dump);
for ($i=0; $i<$dumplen; $i+=2){
$bt=$dump[$i].$dump[$i+1];
$res=$res.chr(hexdec($bt));}
return $res; }

function hexlen($s) {
$s=str_replace(' ', '', $s);
if (strlen($s)/2 <16) $v='0';
if (strlen($s)/2 <256) $v.='0';
if (strlen($s)/2 <4096) $v.='0';
$v.=dechex(strlen($s)/2);
return $v; }

function sockcheck( $sockip, $sockport, $timeout=10) {
$sres=0;
$f=fsockopen($sockip, $sockport, $ern, $ers, $timeout);
if (!$f) {
return 0;
} else {
$s=hex2bin('05 02 00 02');
fputs ($f, $s);
$g=fgets ($f,2);
$list= bin2hex($g);
if (($g[0]==hex2bin('04')) or ($g[0]==hex2bin('05'))) $sres=1;
fclose($f); 
return $sres; }
}


$form = "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"get\">
<center>
<b>PHP socks proxyhunter by nerezus(ICQ 547097),<br> 2005, GPL v.2</b><br>
IP range:<br>
<input type=\"text\" name=\"from\" size=\"15\" maxlength=\"15\">
<input type=\"text\" name=\"to\" size=\"15\" maxlength=\"15\"><br>
Port range:<br>
<input type=\"text\" name=\"pfrom\" size=\"5\" maxlength=\"5\">
<input type=\"text\" name=\"pto\" size=\"5\" maxlength=\"5\"><br>
Timeout: <input type=\"text\" name=\"timeout\" size=\"2\" maxlength=\"2\"><br>
Outfile: <br>
<input type=\"text\" name=\"outfile\" size=\"16\" maxlength=\"255\"><br>
<input type=\"submit\" value=\".: GO! :.\">
</form></center>";
if ($from == '' or $to == '' or $pfrom=='' or $pto=='')  echo $form;  else {
$flist=explode('.', $from);
$tlist=explode('.', $to);
$fip=$flist[0]*256*256*256+$flist[1]*256*256+$flist[2]*256+$flist[3];
$tip=$tlist[0]*256*256*256+$tlist[1]*256*256+$tlist[2]*256+$tlist[3];
for ($i=$fip; $i<=$tip; $i++) {
	$tmp=$i;
	$d1=floor($tmp / (256*256*256)); $tmp=$tmp-$d1*(256*256*256);
	$d2=floor($tmp / (256*256)); $tmp=$tmp-$d2*(256*256);
	$d3=floor($tmp / 256); $tmp=$tmp-$d3*256;
	$d4=$tmp;
	$ip="$d1.$d2.$d3.$d4";
	if (($d4!=0) && ($d4!=255)){ 
		for ($prt=$pfrom; $prt<=$pto; $prt++) {
			if (sockcheck($ip, $prt, $timeout)) { 
				$file = fopen ($outfile, "a");
				echo "$ip:$prt<br>\n";
				fputs ($file, "$ip:$prt\n");
				fclose($file);
				flush();
				}
			}
		
} } }?>
в тему: и Nitrex реализацию посмотрит, и мой покритикуют

Постскриптум: что hex2bin не нужная - знаю, можно ее sprintf заменить
 

Nitrex

Guest
<?
set_time_limit(10);
$socks=file("socks.txt");
$timeout=8;
for ($i=0;$i<count($socks);$i++)
{
$t=explode(":",$socks[$i]);
$t2=explode("\n",$socks[$i]);
$ip=$t[0];
$port=$t[1];

if(!fsockopen($ip,$port,$errno,$errstr))
{
return 0;
}
else {
echo "$socks[$i] - Good<br>";
}
}
?>

хм...все равно ругаеца =(((
 

nerezus

Вселенский отказник
Nitrex
замечательно, "ругаеца" да?
а ты прочитать пробовал? то, на что оно "ругаеца"?
 

Nitrex

Guest
гы.да
он не может прочитать 2 строчку.
 

tristram

Guest
[offtopic]этот нитрекс считает себя хакером, и состоит в хацкерской группе :)[/offtopic]
 

Nitrex

Guest
офтоп:
а это тристрам считает себя высшим ламером.состоит в команде по надуванию шарикофф!
 

netdog

net @
nerezus
// offtopic
Постскриптум: что hex2bin не нужная - знаю, можно ее sprintf заменить
да и sprintf тут не очень то нужен
$bin = "\x05\x02\x00\x02";
также как и твои сверх вычисления ип адреса hint: [m]long2ip[/m] [m]ip2long[/m]
;)

-~{}~ 06.07.05 22:37:

Nitrex
хацкер ты наш юный, кто ОН не может прочитать вторую строчку? цитату этого ОН плиз сюда. =)
 
Сверху