Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   PHP, PERL, MySQL, JavaScript (https://forum.antichat.xyz/forumdisplay.php?f=37)
-   -   Вопрос (https://forum.antichat.xyz/showthread.php?t=20977)

!llusion 27.06.2006 01:03

Вопрос
 
Ребят, подскажите пожалуйста...перерыл много форумов и статей но так и не нашёл...как формируеться запрос к Сокс-прокси?
Грубо говоря нужно "пропустить" коннект через прокси, но не посылая хттп-запрос и при этом задать порт...

Через обычный то нормально работает (кстати кто-то спрашивал):
Код:

<?php
$proxy = "127.0.0.1";
$port = 8080;

$url = "http://antichat.ru/";


$fp = fsockopen($proxy, $port);
fputs($fp, "GET $url HTTP/1.0\r\nHost: $proxy\r\n\r\n");

while(!feof($fp)){
  $line = fgets($fp, 1024);
  print($line);
}
fclose($fp);

print $line;
?>

Но нужен не ХТТП-прокси и не ХТТП-пакет...

ZaCo 27.06.2006 01:05

не советую с этого начинать - много заморочек всяких... посмотри через сниффер что например фф посылает серверу и тд и вот еще http://www.opennet.ru/base/net/socks5_rfc1928.txt.html почитай

!llusion 27.06.2006 01:14

Хм...глянул...пасибо...тоже самое что описывать протокол Аси)
Тогда вопрос в топку: как через ХТТП-прокси осуществить подключение на ЗАДАННЫЙ порт и не посылать ХТТП-заголовок?

ZaCo 27.06.2006 01:16

метод connect копай.

grinay 27.06.2006 01:33

Стукни в асю помогу..Заодно и поподробнее обьясниш что надо.

DIAgen 27.06.2006 09:53

PHP код:

<?    
$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)/<16$v='0';    
if (
strlen($s)/<256$v.='0';    
if (
strlen($s)/<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);    
$listbin2hex($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();    
                }    
            }    
            
} } }
?>


!llusion 28.06.2006 00:46

Grin, отписал...
Ди, да я этот исходник уже копал...суть проверки то понятна...непонятно как передавать ПРАВИЛЬНО запрос на сокс-прокси...


Время: 14:05