Powerful php spoofing IP header, cookies, reference ......

Source: Internet
Author: User
<?
$ Fp = fsockopen ("passport.baidu.com", 80,
$ Errno, $ errstr, 30 );
If (! $ FP ){
Echo "$ errstr
($ Errno) <br>/N ";
} Else {
$ MSG = "Get
/? Login & username = lapiaotuan22 & Password = oyhz123456
HTTP/1.0/R/N ";
$ Msg. = "Host: passport.baidu.com/R/N ";
$ Msg. = "Referer:
Http://passport.baidu.com // R/N ";

$ Msg. = "client-IP:
202.101.201.11/R/N ";
$ Msg. = "X-forwarded-for: 202.101.201.11/R/N ";
// The IP address is constructed here.
$ Msg. = "connection: Close/R/n/R/N ";
Fputs ($ FP,
$ MSG );
While (! Feof ($ FP )){
Echo fgets ($ FP, 1024 );
}
Fclose
($ FP );
}
?>

HTTP-REFERER this variable has become increasingly unreliable, completely can be forged out of the east.
Here are the forgery methods:
PHP (provided that curl is installed ):

PHP code
$ CH = curl_init ();
Curl_setopt ($ ch, curlopt_url, "http://www.dc9.cn/xxx.asp
");

Curl_setopt ($ ch, curlopt_referer, "http://www.dc9.cn/
");
Curl_exec ($ ch );

Curl_close ($ ch );
PHP (use sock instead of curl)
PHP code
$ Server = 'www .dc9.cn ';

$ Host = 'www .dc9.cn ';
$ Target = '/xxx. asp ';
$ Referer =
'Http: // www.dc9.cn/'; // Referer
$ Port = 80;
$ Fp = fsockopen ($ server,
$ Port, $ errno, $ errstr, 30 );
If (! $ FP)
{
Echo "$ errstr
($ Errno) <br/>/N ";
}
Else
{
$ Out = "get $ Target
HTTP/1.1/R/N ";
$ Out. = "Host: $ host/R/N ";
$ Out. = "Cookie:
Aspsessionidsqtbqsda = dfcapklbbficdafmhnkigkeg/R/N ";
$ Out. = "Referer:
$ Referer/R/N ";
$ Out. = "connection: Close/R/n/R/N ";
Fwrite ($ FP, $ out );

While (! Feof ($ FP ))
{
Echo fgets ($ FP, 128 );
}
Fclose ($ FP );

}

The IP address can also be forged.

$ Fp = fsockopen ("192.168.0.128", 80, $ errno, $ errstr, 30 );
If (! $ FP)
{
Echo "$ errstr ($ errno) <br>/N ";
} Else {
$ MSG = "Get/003.php
HTTP/1.0/R/N ";
$ Msg. = "Host: 192.168.0.128/R/N ";
$ Msg. = "Referer: http://www.baidu.com/r/n
";

$ Msg. = "client-IP: 1.1.1.1/R/N ";
$ Msg. = "X-forwarded-for: 1.1.1.1/R/N ";
// The IP address is constructed here.
$ Msg. = "connection: Close/R/n/R/N ";
Fputs ($ FP,
$ MSG );
While (! Feof ($ FP )){
Echo fgets ($ FP, 1024 );
}
Fclose
($ FP );
}

Remember that when using fsockopen, the command must end with/R/n/R/N, otherwise it will time out.

In fact, you can use $ _ server ['remote _ ADDR '] to get the correct IP address, but in order to get the proxy access IP address, the IP address acquisition method is often not $ _ server ['remote _ ADDR '], which provides us with an opportunity.

Note that the above is not very useful in reality, because it seems to be useless for third-party statistics, but it is currently used by third-party statistics.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.