Quantcast
Your Ad Here Os Configurations
Add to Google Reader or Homepage

Saturday, July 23, 2011

How to log IP of Victim using Web page? Ip Logger


So far, i have give some third party websites to track ip address of victim.  Today we are going to create our own website or webpage to track victim IP address.  I have written this PHP code for you.

Let me explain in two different methods
Method 1:
Log ip and redirect to some other interesting webpage(like "cute kittens pictures" page) or trusted page (like "facebook" page).

Method 2:
Log the ip and remains in same page( without redirection). I think "you won't select this method.

In this post , i will explain the method 1.



Requirements:
  • Any free hosting site and basic knowledge about file uploading to hosting.
  • url shortening sites account like co.cc,co.nr[optional]

Method 1-IP log php code: 

Step 1:
Create account in any free web hosting service.

Step 2:
Open notepad++ or notepad (if you have notepadd++, it will better to edit).
Paste the following code:
header("Location:index1.php");
$file="iplog.txt";
$f=fopen($file,'a');
fwrite($f,"-------------------------"."\n");
fwrite($f,"IP Address:".$_SERVER['REMOTE_ADDR']."\n");
fwrite($f,"User Agemt:".$_SERVER['HTTP_USER_AGENT']."\n");
fwrite($f,"Host Name:".php_uname('n')."\n");
fwrite($f,"Operating System:".php_uname('v')."(".php_uname('s').")"."\n");
fclose($f);
//provided by BreakTheSecurity.com
?>

and save it as index.php 

Code Explanation:
If you don't want to know how it is logging the IP, you can skip to the step 3.

header("Location:index1.php"); this will redirect to index1.php page.
 You can specify any other location instead.  For example, if you want to redirect to www.interestingwebsite.com ,then change the code as
header("Location: http://www.interestingwebsite.com");
or
header("Location: http://www.interestingwebsite.com/post.php");
  
$f=fopen($file,'a');  opens the file iplog.txt in append mode( add the contents at the end of file)and store the pointer in variable f.

fwrite($f,string) will write the string into the file(iplog.txt) for example, if the string is "hello", it will be stored inside iplog.txt file.

so fwrite($f,"-------------------------"."\n"); will insert ----------- inside the iplog.txt

fwrite($f,"IP Address:".$_SERVER['REMOTE_ADDR']."\n");
here $_SERVER['REMOTE_ADDR'] is build function ,returns IP address(if you run locally in your pc using wamp/xampp, it will return 127.0.0.1). So after ---------- lines, the "Ip address:127.0.0.1" will be append.

Now the iplog.txt file contains:
--------------------
IP Address: 127.0.0.1
$_SERVER['HTTP_USER_AGENT'] returns the current user agent used by victim.  It will contains information about the browser details(mozilla 3.6,ie),operating system(xp,linux).

php_uname('n') returns the Host name .  Now the iplog.txt contains

--------------------
IP Address: 127.0.0.1
User Agent: Mozilla (linux) (ubuntu 11.10) Mozilla3.6
HostName: xxxx.limestonenetwork.com

fclose($f); will close the opened file.

Step 3:
Open notepad and save the file as "iplog.txt"

Step 4:
again open the notepad and create your own php or html page. It should be some interesting contents(download any website templates,rename the index.html file to index1.html).
Example 1(html):



save the file as index1.html.
Example 2(php):


<?php echo "Cute kittens"; ?>


 
 save the file as index1.php


Step 5:
Now you have 3 files namely index.php,index1.php,iplog.txt.
Upload these files to your hosting.
File uploaded to hosting account
set iplog.txt permisson to read and write by global.

Set file permission for iplog.txt

Step 4:
Check whether it is working or not by visiting the your hosting sub domain account.
For example:
http://uraccount.hosting.com/index.php
if you enter the url, it will redirect from index.php to index1.php.
Now open the iplog.txt.  There you can see the logged information.

Step 5:
Send to your friend or victim with attractive mail content and title. At the end, ask him to visit the link to know more about the info.



Redirected to index1.php


Logged Details ,stored in iplog.txt file

Once he visit the link, his IP address is in your hands.

No comments:

Post a Comment