PHP uses curl to forge IP addresses and routes _ PHP Tutorial

Source: Internet
Author: User
PHP uses curl to forge IP addresses and routes. Counterfeit files: 1.php? Php $ chcurl_init (); curl_setopt ($ ch, CURLOPT_URL, localhost2.php); curl_setopt ($ ch, CURLOPT_HTTPHEADER, array (X-FORWARDED-FOR: 8.8.8.8

Effect
Forged File: 1.php

$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, "http: // localhost/2.php ");
Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('x-FORWARDED-FOR: 8.8.8.8 ', 'client-IP: 8.8.8.8'); // Construct an IP address
Curl_setopt ($ ch, CURLOPT_REFERER, "http://www.xssxss.com/"); // Construct a path
Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
$ Out = curl_exec ($ ch );
Curl_close ($ ch );
?>
Script 2.php for viewing results

Function getClientIp (){
If (! Empty ($ _ SERVER ["HTTP_CLIENT_IP"])
$ Ip = $ _ SERVER ["HTTP_CLIENT_IP"];
Else if (! Empty ($ _ SERVER ["HTTP_X_FORWARDED_FOR"])
$ Ip = $ _ SERVER ["HTTP_X_FORWARDED_FOR"];
Else if (! Empty ($ _ SERVER ["REMOTE_ADDR"])
$ Ip = $ _ SERVER ["REMOTE_ADDR"];
Else
$ Ip = "err ";
Return $ ip;
}
Echo "IP:". getClientIp ()."";
Echo "referer:". $ _ SERVER ["HTTP_REFERER"];

From www.xssxss.com/fuck/519.xss

Ghost Files: 1.php? Php $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, http: // localhost/2.php); curl_setopt ($ ch, CURLOPT_HTTPHEADER, array (X-FORWARDED-FOR: 8.8.8...

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.