Jump to content
Aplicatiile pentru functia de "Helper" pentru serverul de Minecraft sunt deschise !

[Php] Anti Proxy Pro


Guest Mecanik

Recommended Posts

Guest Mecanik

In ziua de azi,foarte multi hackeri folosesc Proxy,adica un alt IP pentru a ascunde IP-ul real.

Sunt mai multe tipuri de Proxy,si inca nu am reusit sa detectez orice Proxy...

Dar totusi am realizat un script,din mai multe surse gasite pe Google,si am reusit cumva sa fac un sistem Anti Proxy destul de bun!


<?php

//

// Script php : Anti Proxy

// By :Mecanik-Addicted2- 2012

//

// Copyright http://www.addicted2.ro

//

@set_time_limit(0);

@error_reporting(E_ALL | E_NOTICE);



function get_ip() {

  if($_SERVER) {

    if($_SERVER['HTTP_X_FORWARDED_FOR'])

	  $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];

    elseif($_SERVER['HTTP_CLIENT_IP'])

	  $ip = $_SERVER['HTTP_CLIENT_IP'];

    else

	  $ip = $_SERVER['REMOTE_ADDR'];

  }

  else {

    if(getenv('HTTP_X_FORWARDED_FOR'))

	  $ip = getenv('HTTP_X_FORWARDED_FOR');

    elseif(getenv('HTTP_CLIENT_IP'))

	  $ip = getenv('HTTP_CLIENT_IP');

    else

	  $ip = getenv('REMOTE_ADDR');

  }



  return $ip;

}



function detect_proxy($myIP) {

   $scan_headers = array(

   'HTTP_VIA',

   'HTTP_X_FORWARDED_FOR',

   'HTTP_FORWARDED_FOR',

   'HTTP_X_FORWARDED',

   'HTTP_FORWARDED',

   'HTTP_CLIENT_IP',

   'HTTP_FORWARDED_FOR_IP',

   'VIA',

   'X_FORWARDED_FOR',

   'FORWARDED_FOR',

   'X_FORWARDED',

   'FORWARDED',

   'CLIENT_IP',

   'FORWARDED_FOR_IP',

   'HTTP_PROXY_CONNECTION'

  );



   $flagProxy = false;

   $libProxy = 'No';



   foreach($scan_headers as $i)

   if($_SERVER[$i]) $flagProxy = true;



   if (    in_array($_SERVER['REMOTE_PORT'], array(8080,80,6588,8000,3128,553,554))

	    || @fsockopen($_SERVER['REMOTE_ADDR'], 80, $errno, $errstr, 30))

	  $flagProxy = true;



   // Proxy LookUp

   if ( $flagProxy == true &&

	    isset($_SERVER['REMOTE_ADDR']) &&

	    !empty($_SERVER['REMOTE_ADDR']) )

		 // Transparent Proxy

		 // REMOTE_ADDR = proxy IP

		 // HTTP_X_FORWARDED_FOR = your IP  

		 if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) &&

			  !empty($_SERVER['HTTP_X_FORWARDED_FOR']) &&

			  $_SERVER['HTTP_X_FORWARDED_FOR'] == $myIP

		    )

			 $libProxy = 'Transparent Proxy';

			   // Simple Anonymous Proxy		   

			  // REMOTE_ADDR = proxy IP

			  // HTTP_X_FORWARDED_FOR = proxy IP

		 else if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) &&

				   !empty($_SERVER['HTTP_X_FORWARDED_FOR']) &&

				   $_SERVER['HTTP_X_FORWARDED_FOR'] == $_SERVER['REMOTE_ADDR']

				 )

				 $libProxy = 'Simple Anonymous (Transparent) Proxy';

			  // Distorting Anonymous Proxy		   

			  // REMOTE_ADDR = proxy IP

			  // HTTP_X_FORWARDED_FOR = random IP address

			  else if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) &&

					    !empty($_SERVER['HTTP_X_FORWARDED_FOR']) &&

					    $_SERVER['HTTP_X_FORWARDED_FOR'] != $_SERVER['REMOTE_ADDR']

					  )

					  $libProxy = 'Distorting Anonymous (Transparent) Proxy';

				   // Anonymous Proxy

				   // HTTP_X_FORWARDED_FOR = not determined

				   // HTTP_CLIENT_IP = not determined

				   // HTTP_VIA = determined

				   else if ( $_SERVER['HTTP_X_FORWARDED_FOR'] == '' &&

							 $_SERVER['HTTP_CLIENT_IP'] == '' &&

							 !empty($_SERVER['HTTP_VIA'])

						   )

						   $libProxy = 'Anonymous Proxy';

					    // High Anonymous Proxy		   

					    // REMOTE_ADDR = proxy IP

					    // HTTP_X_FORWARDED_FOR = not determined				   

					    else

						   $libProxy = 'High Anonymous Proxy';



   return $libProxy;

}



$ip = get_ip();



echo 'Proxy Server Detection<br>';

echo '=================<br><br>';

$typeProxy = detect_proxy($ip);

echo 'Use Proxy Server : '.$typeProxy.'<br>';

echo '<br>';

echo 'Brief IP Information'.'<br>';

echo '--------------------'.'<br>';

echo 'Your IP : '.$ip.'<br>';

echo 'Language : '.$_SERVER['HTTP_ACCEPT_LANGUAGE'].'<br>';

echo '<br>';

echo 'Detail IP Information'.'<br>';

echo '---------------------'.'<br>';

echo 'HTTP_ACCEPT : '.$_SERVER['HTTP_ACCEPT'].'<br>';

echo 'HTTP_ACCEPT_ENCODING : '.$_SERVER['HTTP_ACCEPT_ENCODING'].'<br>';

echo 'HTTP_ACCEPT_LANGUAGE : '.$_SERVER['HTTP_ACCEPT_LANGUAGE'].'<br>';

echo 'HTTP_ACCEPT_CHARSET : '.$_SERVER['HTTP_ACCEPT_CHARSET'].'<br>';

echo 'HTTP_CONNECTION : '.$_SERVER['HTTP_CONNECTION'].'<br>';

echo 'HTTP_HOST : '.$_SERVER['HTTP_HOST'].'<br>';

echo 'HTTP_KEEP_ALIVE : '.$_SERVER['HTTP_KEEP_ALIVE'].'<br>';

echo 'HTTP_USER_AGENT : '.$_SERVER['HTTP_USER_AGENT'].'<br>';

echo 'REMOTE_HOST : '.@gethostbyaddr($_SERVER['REMOTE_ADDR']).'<br>';

echo 'REMOTE_PORT : '.$_SERVER['REMOTE_PORT'].'<br>';

echo '<br>';

echo 'REMOTE_ADDR : '.$_SERVER['REMOTE_ADDR'].'<br>';

echo 'HTTP_VIA : '.$_SERVER['HTTP_VIA'].'<br>';

echo 'HTTP_X_FORWARDED_FOR : '.$_SERVER['HTTP_X_FORWARDED_FOR'].'<br>';

echo 'HTTP_PROXY_CONNECTION : '.$_SERVER['HTTP_PROXY_CONNECTION'].'<br>';

echo 'HTTP_CLIENT_IP : '.$_SERVER['HTTP_CLIENT_IP'].'<br>';

?>

Codul se poate salva ca antiproxy.php,si se poate include in index.php prin include_once('antiproxy.php'); Atentie: Codul inca nu a fost optimizat pentru versiunile PHP 5.3.X Daca apare vreo eroare tip : Notice: Undefined index , inseamna ca aveti PHP 5.3.X. Solutia:

error_reporting(E_ALL);

ini_set('display_errors', '0');

[/code]

Se pune in [b]index.php[/b] (doar in cazul de mai sus!)

Sper sa va fie de folos!

[i]PS: Am sa optimizez codul pentru PHP 5.3.X dupa sarbatori.[/i]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...