ainars Posted September 15, 2004 Report Share Posted September 15, 2004 <?php /* Title: Proxy Detection Version: v2.0 Description: This will detect any suspicious open socket that the user is running and if found in an array, it will not let the user proceed to the website, with the ability to allow certain hosts to pass the scan, and disallowing certain hosts completely. You can define a redirect page to redirect the user to upon open socket. Usage: Just include this page in any webpage you want protected. */ /* Modify these next few lines to whatever you like. */ $Ports = array('1080', '8080', '8000', '3128', '8888', '23', '80', '8081'); // To hold the list of ports. $AllowedHosts = array('localhost', 'allowedhost.com'); // To hold the list of allowed hosts. $DisallowedHosts = array('127.0.0.1.poo.com', 'something.msn.com'); // To hold the list of disallowed hosts. $Redirect = "http://www.unixcon.net/~datalogik/scripts/"; // Redirect page $SocketTimeout = 1; // Higher the number, the longer it takes. /* End of modification. */ if ((!in_array ($REMOTE_ADDR, $AllowedHosts)) && (!in_array ($REMOTE_ADDR, $DisallowedHosts))) { $x = 1; while ($Ports[$x]) { $fSockPointer = fsockopen($REMOTE_ADDR, $Ports[$x], $errno, $errstr, $SocketTimeout); if ($fSockPointer) { header ("Location: $Redirect"); fclose($fSockPointer); } $x++; } } else { if (in_array ($REMOTE_ADDR, $AllowedHosts)) { die(); } else { header ("Location: $Redirect"); die(); } } ?> :ph34r: Link to comment Share on other sites More sharing options...
Venom Posted September 15, 2004 Report Share Posted September 15, 2004 (edited) ā) ports 1080 nekad netiks pārbaudīts un while pat izmetīs erroru pie x>=8 bē) what's the point? mēģinām noteikt, vai pie tevīm saitā ienāk proksis? cē) tikuntā nevis $REMOTE_ADDR, bet gan $_SERVER['REMOTE_ADDR'] utml. Edited September 15, 2004 by Venom Link to comment Share on other sites More sharing options...
bubu Posted September 15, 2004 Report Share Posted September 15, 2004 A ja jūzerim pašam priekš sevis squid proksis uzlikts vai pat apache serveris vienkārši uzmukts? Link to comment Share on other sites More sharing options...
ainars Posted September 16, 2004 Author Report Share Posted September 16, 2004 ā) ports 1080 nekad netiks pārbaudīts un while pat izmetīs erroru pie x>=8bē) what's the point? mēģinām noteikt, vai pie tevīm saitā ienāk proksis? cē) tikuntā nevis $REMOTE_ADDR, bet gan $_SERVER['REMOTE_ADDR'] utml. Saitā šādu scriptu neizmantošu.... ieliku to tikai lai Jums būtu ko notestēt :) Link to comment Share on other sites More sharing options...
Venom Posted September 16, 2004 Report Share Posted September 16, 2004 Saitā šādu scriptu neizmantošu.... ieliku to tikai lai Jums būtu ko notestēt :) open source ideoloģija Link to comment Share on other sites More sharing options...
Recommended Posts