PoiNtEr->: How To Create A Web Beacon ?

                             Difference between a dream and an aim. A dream requires soundless sleep, whereas an aim requires sleepless efforts.

Search This Blog

Tuesday, January 24, 2012

How To Create A Web Beacon ?


Hi guys! Yesterday I came to known about  "web beacons" from one of my classmate and then i started my research on it.So first thing is what is web Beacon?? According to me its a technique of tracking web users,it answers many questions like whether somebody opened your email,webpage etc.Big Company also make money by selling this information about their users and facebook is one of them . You can get more info about web beacon here.So now lets go to implementation part .
So here is my Small beacon which will give me info about users visiting my websites.

Web Beacon

I hope you have apache2 up and working.I am using my ubuntu 11.04 apache web server for this test.
We will add following code to our main html page...suppose its name is index.html


<img src="192.168.2.200/trackme.php?identifier" alt=" " > 


In place of 192.168.2.200 use your own domain name or where you have saved trackme.php file 



Now make another file trackme.php and add following code in it:

<?php
$hostname=gethostbyaddr($_SERVER['REMOTE_ADDR']);
$QUERY_STRING = preg_replace("%[^/a-zA-Z0-9@,_]%", '', $_SERVER['QUERY_STRING']);
//saves ip address and timestamp
$str=date("D dS M,Y h:i a") . ",". $_SERVER['REMOTE_ADDR'] .",".$QUERY_STRING.",".$hostname.",".$_SERVER['HTTP_USER_AGENT'].",".$_SERVER['HTTP_REFERER']."\n";

file_put_contents("tracker.txt", $str, FILE_APPEND);

header("content-type: image/gif");
//43byte 1x1 transparent pixel gif
echo base64_decode("R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
?>





Now above php script is going to save information about user in a file named tracker.txt

So create a file named tracker.txt and change its permission to  777


Now everytime if somebody comes to your webpage(Index.html) he will leave information about himself in your tracker.txt.


I have created all these files in my /var/www/


For making transparent beacon image you can also use the following pattern too in trackme.php file

# The transparent, beacon image
echo chr(71).chr(73).chr(70).chr(56).chr(57).chr(97).
chr(1).chr(0).chr(1).chr(0).chr(128).chr(0).
chr(0).chr(0).chr(0).chr(0).chr(0).chr(0).chr(0).
chr(33).chr(249).chr(4).chr(1).chr(0).chr(0).
chr(0).chr(0).chr(44).chr(0).chr(0).chr(0).chr(0).
chr(1).chr(0).chr(1).chr(0).chr(0).chr(2).chr(2).
chr(68).chr(1).chr(0).chr(59);





 So GO n HacK Some Information guys !!





Reference:here

2 comments: