Phpcurl spoofs IP addresses and routes
- $ Headers ['client-IP'] = '192. 103.229.40 ';
- $ Headers ['X-FORWARDED-FOR '] = '2017. 103.229.40 ';
-
- $ HeaderArr = array ();
- Foreach ($ headers as $ n => $ v ){
- $ HeaderArr [] = $ n. ':'. $ v;
- }
-
- Ob_start ();
- $ Ch = curl_init ();
- Curl_setopt ($ ch, CURLOPT_URL, "http: // localhost/curl/server. php ");
- Curl_setopt ($ ch, CURLOPT_HTTPHEADER, $ headerArr); // Construct an IP address
- Curl_setopt ($ ch, CURLOPT_REFERER, "http://bbs.it-home.org/"); // Construct a path
- Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
-
- Curl_exec ($ ch );
- Curl_close ($ ch );
- $ Out = ob_get_contents ();
- Ob_clean ();
-
- Echo $ out;
- ?>
2. curl spoofs the IP address and comes to the server. php
- Function GetIP (){
- If (! Empty ($ _ SERVER ["HTTP_CLIENT_IP"])
- $ Cip = $ _ SERVER ["HTTP_CLIENT_IP"];
- Else if (! Empty ($ _ SERVER ["HTTP_X_FORWARDED_FOR"])
- $ Cip = $ _ SERVER ["HTTP_X_FORWARDED_FOR"];
- Else if (! Empty ($ _ SERVER ["REMOTE_ADDR"])
- $ Cip = $ _ SERVER ["REMOTE_ADDR"];
- Else
- $ Cip = "cannot be obtained! ";
- Return $ cip;
- }
- Echo"
Access IP: ". GetIP ()." ";
- Echo"
Access path: ". $ _ SERVER [" HTTP_REFERER "];
- ?>
Supplement: $ _ SERVER ['remote _ ADDR '] cannot be forged. |