Last updated: November 14, 2022
An IP address is a unique number that allows a computer to communicate in a network. It is needed to send and receive information, much like a postal address is needed to receive regular mail.
Obtaining an IP address is not very difficult to do. We have already seen how to do it with the Email Tracking technique.
However, here we are going to share with you another more sophisticated technique which consists of retrieve a user's IP address using a simple image that has PHP code in it.
How to retrieve an IP address using an image?
Start by finding a free hosting space where you can host all kinds of files. Then create a new file named .htaccess and paste the following code into that file.
AddHandler application / x-httpd-php80 .jpg
This htaccess code will entrust the execution of the ".jpg" files to PHP
Now create another file grabber.jpg with a text editor and insert the following code into it:
$ fh = fopen ('ip_list.txt', 'a');
fwrite ($ fh, $ _SERVER ['REMOTE_ADDR']. "
fclose ($ fh);
$ im = imagecreatefromjpeg ("ladygaga.jpeg");
header ('Content-Type: image / jpeg');
imagejpeg ($ im);
imagedestroy ($ im);
- imagecreatefromjpeg () returns an image identifier representing an image obtained from the file filename.
- imagejpeg () display or save an image in jpeg format using image image.
- imagedestroy () frees all the memory associated with the image image.
Finally, find a real picture that you want the victim to see (in our case, it's ladygaga.jpg). Add the three files (grabber.jpg, ladygaga.jpg and .htaccess) in a single folder and change the permissions of grabber.jpg to 755.
Our image is now ready to use, all that remains is to host it and send it to your target. When the latter opens the image, its IP address will be added to the file ip_list.txt.