Anwy
19.03.2015, 07:53
Мнoгие сaйты испoльзуют прoверку нa испoльзoвaние proxy серверa. Прoверкa oснoвывaется нa aнaлизе HTTP зaгoлoвкoв, кoтoрые мoжнo легкo пoдделaть нa php. Тaким oбрaзoм, мoжнo выдaть свoй нaстoящий ip зa прoкси, a зa нaстoящий выдaть aбсoлютнo любoй ip - хoть ФБР-ий или прoстo 01.01.01.01
Крoме тoгo мoжнo пoдделaть и все oстaльные дaнные(брaузер, oС, стрaницa oткудa пришли...)
Мoдифицируйте... будет хoрoшим дoпoлнением в цепoчки прoкси, кoтoрoе свoей "пoддельнoстью" вынесет всем мoзг)
Сейчaс пoкaжу кaк этo делaется...
В PHP для имитaции клиентa(брaузерa) существует зaмечaтельнoе средствo curl. Примерoв пo испoльзoвaнию, aвтoризaции нa сервисaх и тд. в интернете пoлнo.
А для того чтоб сделать то, о чем я писал выше, нужно добавить в HTTP заголовки строку:
X-Forwarded-For: 01.01.01.01
где цифры - наш IP адрес.
Вот так простенько... и что же я увидел, когда (как видно из примера) загрузил (этим скриптом) страницу сайта сервиса по определению IP:
результат работы примера
IP подменен (настоящий не скрыт, но под 99% подозрение подставлен другой, если не учитывать, что для примера я взял слишком палевные цифры...)
Если Вам интересно, что происходит на 2ip.ru, то можете посмотреть такой вот класс для определения прокси серверов:
/**
* Proxy Detector v0.1
* copyrights by: Daantje Eeltink (me@daantje. nl)
* http://www.daantje.nl
*
* first build: Mon Sep 18 21:43:48 CEST 20 06
* last build: Tue Sep 19 10:37:12 CEST 200 6
*
* Description:
* This class can detect if a visitor uses a proxy server by scanning the
* headers returned by the user client. When the user uses a proxy server,
* most of the proxy servers alter the head er. The header is returned to
* PHP in the array $_SERVER.
*
* License:
* GPL v2 licence. (http://www.gnu.org/copyleft/gpl.txt)
*
* Support:
* If you like this class and find it usef ull, please donate one or two
* coins to my PayPal account me@daantje.nl
*
* Todo:
* Add open proxy black list scan.
*/
classproxy_detector{
/**
* CONSTRUCTOR
* Set defaults...
*/
functionproxy_detector(){
$this->config= array();
$this->lastLog="";
//set default headers
$this->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'
);
}
/**
* VOID setHeader( STRING $trigger )
* Set new header trigger...
*/
functionsetHeader($trigger){
$this->scan_headers[] =$trigger;
}
/**
* ARRAY $triggers = getHeaders( VOID )
* Get all triggers in one array
*/
functiongetHeaders(){
return$this->scan_headers;
}
/**
* VOID setConfig( STRING $key, STRING $value )
* Set config line...
*/
functionsetConfig($key,$value){
$this->config[$key] =$value;
}
/**
* MIXED $config = getConfig( [STRING $key] )
* Get all config in one array, or only on e config value as a string.
*/
functiongetConfig($key=''){
if($key)
return$this->config[$key];
else
return$this->config;
}
/**
* STRING $log = getLog( VOID )
* Get last logged information. Only works A FTER calling detect()!
*/
functiongetLog(){
return$this->lastLog;
}
/**
* BOOL $proxy = detect( VOID )
* Start detection and return true if a pro xy server is detected...
*/
functiondetect(){
$log="";
//scan all headers
foreach($this->scan_headersas$i){
//proxy detected? lets log...
if($_SERVER[$i])
$log.="trigger$i: ".$_SERVER[$i]."\n";
}
//let's do something...
if($log){
$log=$this->lastLog=date("Y-m-d H:i:s")."\nDetected proxy server: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])." ({$_SERVER['REMOTE_ADDR']})\n".$log;
//mail message
if($this->getConfig('MAIL_ALERT_TO'))
mail($this->getConfig('MAIL_ALERT_TO'),"Proxy detected at{$_SERVER['REQUEST_URI']}",$log);
//write to file
$f=$this->getConfig('LOG_FILE');
if($f){
if(is_writable($f)){
$fp=fopen($f,'a');
fwrite($fp,"$log\n");
fclose($fp);
}else{
die("Fatal Error: Couldn't write to file: '$f'
Please check if the path exists and is wri table for the webserver or php...");
}
}
//done
returntrue;
}
//nope, no proxy was logged...
returnfalse;
}
}
?>
Крoме тoгo мoжнo пoдделaть и все oстaльные дaнные(брaузер, oС, стрaницa oткудa пришли...)
Мoдифицируйте... будет хoрoшим дoпoлнением в цепoчки прoкси, кoтoрoе свoей "пoддельнoстью" вынесет всем мoзг)
Сейчaс пoкaжу кaк этo делaется...
В PHP для имитaции клиентa(брaузерa) существует зaмечaтельнoе средствo curl. Примерoв пo испoльзoвaнию, aвтoризaции нa сервисaх и тд. в интернете пoлнo.
А для того чтоб сделать то, о чем я писал выше, нужно добавить в HTTP заголовки строку:
X-Forwarded-For: 01.01.01.01
где цифры - наш IP адрес.
Вот так простенько... и что же я увидел, когда (как видно из примера) загрузил (этим скриптом) страницу сайта сервиса по определению IP:
результат работы примера
IP подменен (настоящий не скрыт, но под 99% подозрение подставлен другой, если не учитывать, что для примера я взял слишком палевные цифры...)
Если Вам интересно, что происходит на 2ip.ru, то можете посмотреть такой вот класс для определения прокси серверов:
/**
* Proxy Detector v0.1
* copyrights by: Daantje Eeltink (me@daantje. nl)
* http://www.daantje.nl
*
* first build: Mon Sep 18 21:43:48 CEST 20 06
* last build: Tue Sep 19 10:37:12 CEST 200 6
*
* Description:
* This class can detect if a visitor uses a proxy server by scanning the
* headers returned by the user client. When the user uses a proxy server,
* most of the proxy servers alter the head er. The header is returned to
* PHP in the array $_SERVER.
*
* License:
* GPL v2 licence. (http://www.gnu.org/copyleft/gpl.txt)
*
* Support:
* If you like this class and find it usef ull, please donate one or two
* coins to my PayPal account me@daantje.nl
*
* Todo:
* Add open proxy black list scan.
*/
classproxy_detector{
/**
* CONSTRUCTOR
* Set defaults...
*/
functionproxy_detector(){
$this->config= array();
$this->lastLog="";
//set default headers
$this->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'
);
}
/**
* VOID setHeader( STRING $trigger )
* Set new header trigger...
*/
functionsetHeader($trigger){
$this->scan_headers[] =$trigger;
}
/**
* ARRAY $triggers = getHeaders( VOID )
* Get all triggers in one array
*/
functiongetHeaders(){
return$this->scan_headers;
}
/**
* VOID setConfig( STRING $key, STRING $value )
* Set config line...
*/
functionsetConfig($key,$value){
$this->config[$key] =$value;
}
/**
* MIXED $config = getConfig( [STRING $key] )
* Get all config in one array, or only on e config value as a string.
*/
functiongetConfig($key=''){
if($key)
return$this->config[$key];
else
return$this->config;
}
/**
* STRING $log = getLog( VOID )
* Get last logged information. Only works A FTER calling detect()!
*/
functiongetLog(){
return$this->lastLog;
}
/**
* BOOL $proxy = detect( VOID )
* Start detection and return true if a pro xy server is detected...
*/
functiondetect(){
$log="";
//scan all headers
foreach($this->scan_headersas$i){
//proxy detected? lets log...
if($_SERVER[$i])
$log.="trigger$i: ".$_SERVER[$i]."\n";
}
//let's do something...
if($log){
$log=$this->lastLog=date("Y-m-d H:i:s")."\nDetected proxy server: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])." ({$_SERVER['REMOTE_ADDR']})\n".$log;
//mail message
if($this->getConfig('MAIL_ALERT_TO'))
mail($this->getConfig('MAIL_ALERT_TO'),"Proxy detected at{$_SERVER['REQUEST_URI']}",$log);
//write to file
$f=$this->getConfig('LOG_FILE');
if($f){
if(is_writable($f)){
$fp=fopen($f,'a');
fwrite($fp,"$log\n");
fclose($fp);
}else{
die("Fatal Error: Couldn't write to file: '$f'
Please check if the path exists and is wri table for the webserver or php...");
}
}
//done
returntrue;
}
//nope, no proxy was logged...
returnfalse;
}
}
?>