Example of phpcurl counterfeit IP source

Source: Internet
Author: User
Phpcurl is too powerful as an example of counterfeit IP source phpcurl. it not only imitates user logon, but also imitates user IP addresses to forge IP source. File fake_ip.php: & lt ;? Php $ chcurl_init (); $ urllocalhosttarget_ip.php; $ headerarray (php curl counterfeit IP source example)
Php curl is too powerful. it not only imitates user logon, but also imitates user IP addresses, to forge IP sources.

Curl sends the request file fake_ip.php:
  


Target file target_ip.php of the request:
  


The IP address printing sequence in the target file target_ip is the IP address acquisition sequence of many open-source systems.
Access fake_ip.php and see the result:
58.68.44.61
58.68.44.61
127.0.0.1
Instance
CURL is really powerful and can forge IP addresses and sources.
1. php requests 2.php.

1. php code:
$ Ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, "http: // localhost/2.php"); curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('x-FORWARDED-: 8.8.8.8 ', 'client-IP: 8.8.8.8'); // Construct an IP address www. jbxue. comcurl_setopt ($ ch, CURLOPT_REFERER, "http://www.jb51.net/"); // Construct the Origin curl_setopt ($ ch, CURLOPT_HEADER, 1); $ out = curl_exec ($ ch ); curl_close ($ ch );


2. php code:
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 // www.jbxue.com$ip = "err"; return $ip; } echo "IP: " . getClientIp() . ""; echo "referer: " . $_SERVER["HTTP_REFERER"];


Forged successfully. does this provide a good IP address change solution for the "ticket swiping" friend?

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.