| | | 
Progenic Family

Group: Forum Members Last Login: Today @ 7:30 PM Posts: 338, Visits: 2,147 |
| Im trying to make an app that will take user input "ip and port #" then connect to it and test it by connection to another app on the same server which just returns the IP address via $_SERVER['REMOTE_ADDR'] to see if its anonymous. the section below is just the checker section of the app. when its done it will add the ip port and type to a data base, and also make checks of the data base on demand. i cant make it work however, can you see what i did wrong??
$do = 'add'; switch($do) { case add: $addy = '195.248.190.27'; //Proxy addr $port = '3128'; //Proxy port $type = 'Anonymous'; //hope the proxy is anon $sock = fsockopen($addy, $port, $errno, $errstr, 30); //connect if(!$sock) { die('You sure this proxy is active??'); //could not connect } //Now test the proxy $test = 'GET http://38.119.187.37/procheck.php HTTP/1.1\r'; //this will forward the connection to a proxy check on the same server $test .= 'Host: 38.119.187.37:80\r'; $test .= 'Connection: Close\r\r'; fwrite($sock, $test); while(!feof($sock)) { //if we get 38.119.187.37 back from the proxy its not anonymous if(fgets($sock, 128) == '38.119.187.37') { $type = 'Transparent'; //change from anonymous to trans } } echo $type; } ?>
< ?
$a = 'RTFM';
$b = 'STFU';
echo $a.' & '.$b;
?> |
| | | | 
Progenic Family

Group: Forum Members Last Login: Today @ 8:22 AM Posts: 332, Visits: 1,936 |
| | You're making a GET request to your proxy server. You should open a new socket to the website you want to GET, and GET there. |
| | | | 
Progenic Family

Group: Forum Members Last Login: Today @ 7:30 PM Posts: 338, Visits: 2,147 |
| G-Brain (6/21/2008) You're making a GET request to your proxy server. You should open a new socket to the website you want to GET, and GET there.
bypassing the proxy??
the idea is to connect thru the proxy to see if it forwards the ip address.
< ?
$a = 'RTFM';
$b = 'STFU';
echo $a.' & '.$b;
?> |
| | | | 
Progenic Family

Group: Forum Members Last Login: Today @ 8:22 AM Posts: 332, Visits: 1,936 |
| Anarchy Angel (6/21/2008) bypassing the proxy??
the idea is to connect thru the proxy to see if it forwards the ip address.
Oh, I don't know. Wouldn't it be a lot easier to use the proxy in cURL? |
| | | | 
Progenic Family

Group: Forum Members Last Login: Today @ 7:30 PM Posts: 338, Visits: 2,147 |
| G-Brain (6/21/2008)
Anarchy Angel (6/21/2008) bypassing the proxy??
the idea is to connect thru the proxy to see if it forwards the ip address.
Oh, I don't know. Wouldn't it be a lot easier to use the proxy in cURL?
nope it will slow the execution
< ?
$a = 'RTFM';
$b = 'STFU';
echo $a.' & '.$b;
?> |
| | | | New Member

Group: Forum Members Last Login: Sunday, August 31, 2008 5:46 PM Posts: 3, Visits: 27 |
| Try these scripts.
I changed the proxy address because I was testing with tor.
testproxy.php is what you will run.
test.php is what testproxy.php will connect to, to retrieve the proxy information.
testproxy.php
$data = '';
$addy = '127.0.0.1'; //Proxy addr $port = '8118'; //Proxy port
$sock = fsockopen($addy, $port, $errno, $errstr, 30) or die('You sure this proxy is active??');
$HTTP_Request = "GET http://example.com:80/proxy/test.php HTTP/1.0\r"; $HTTP_Request .= "Host: example.com\r"; $HTTP_Request .= "Connection: Close\r\r";
fwrite($sock, $HTTP_Request);
while(!feof($sock)){ $data .= fread($sock, 512); }
fclose($sock);
$pattern = "#(REMOTE_ADDR|HTTP_X_FORWARDED_FOR|HTTP_VIA) .*?)#";
if(preg_match_all($pattern, $data, $matches)){
$num_of_matches = count($matches[0])-1;
for ($x = 0; $x <= $num_of_matches; $x++){ switch($matches[1][$x]){ case 'REMOTE_ADDR': echo "The IP Address connecting to the web server is: {$matches[2][$x]}"; break;
case 'HTTP_X_FORWARDED_FOR': echo "The proxy shows your IP Address is: {$matches[2][$x]}"; break;
case 'HTTP_VIA': echo "The proxy software is: {$matches[2][$x]}"; break; } } }
?>
test.php
echo "REMOTE_ADDR:{$_SERVER['REMOTE_ADDR']}";
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) echo "HTTP_X_FORWARDED_FOR:".htmlentities($_SERVER['HTTP_X_FORWARDED_FOR']);
if(isset($_SERVER['HTTP_VIA'])) echo "HTTP_VIA:".htmlentities($_SERVER['HTTP_VIA']);
?>
h4ck-y0u.org
|
| | | | 
Progenic Family

Group: Forum Members Last Login: Today @ 7:30 PM Posts: 338, Visits: 2,147 |
| h4ck-y0u (6/21/2008)
Try these scripts.
I changed the proxy address because I was testing with tor.
testproxy.php is what you will run.
test.php is what testproxy.php will connect to, to retrieve the proxy information.
testproxy.php
$data = '';
$addy = '127.0.0.1'; //Proxy addr $port = '8118'; //Proxy port
$sock = fsockopen($addy, $port, $errno, $errstr, 30) or die('You sure this proxy is active??');
$HTTP_Request = "GET http://example.com:80/proxy/test.php HTTP/1.0\r"; $HTTP_Request .= "Host: example.com\r"; $HTTP_Request .= "Connection: Close\r\r";
fwrite($sock, $HTTP_Request);
while(!feof($sock)){ $data .= fread($sock, 512); }
fclose($sock);
$pattern = "#(REMOTE_ADDR|HTTP_X_FORWARDED_FOR|HTTP_VIA) .*?)#";
if(preg_match_all($pattern, $data, $matches)){
$num_of_matches = count($matches[0])-1;
for ($x = 0; $x <= $num_of_matches; $x++){ switch($matches[1][$x]){ case 'REMOTE_ADDR': echo "The IP Address connecting to the web server is: {$matches[2][$x]}"; break;
case 'HTTP_X_FORWARDED_FOR': echo "The proxy shows your IP Address is: {$matches[2][$x]}"; break;
case 'HTTP_VIA': echo "The proxy software is: {$matches[2][$x]}"; break; } } }
?>
test.php
echo "REMOTE_ADDR:{$_SERVER['REMOTE_ADDR']}";
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) echo "HTTP_X_FORWARDED_FOR:".htmlentities($_SERVER['HTTP_X_FORWARDED_FOR']);
if(isset($_SERVER['HTTP_VIA'])) echo "HTTP_VIA:".htmlentities($_SERVER['HTTP_VIA']);
?>
ill give it a try tyvm you
< ?
$a = 'RTFM';
$b = 'STFU';
echo $a.' & '.$b;
?> |
| | | | New Member

Group: Forum Members Last Login: Sunday, August 31, 2008 5:46 PM Posts: 3, Visits: 27 |
| | |
|
|