Introduction: How to Prank Your Friend by Hacking DNS on His/her Computer
Do you have a friend, who constantly uses internet? Have you ever wanted to prank him/her? Well, in this instructable you'll learn how to do this.
In this instructable you will learn how to hack Domain Name System (DNS) on Windows, in order to redirect users from normal site (for example: google.com) to another website (which may be running on localhost). This is done by modifying hosts file, the main purpose of existence of this file is to assign website's ip addresses to their domains (see picture).
* Friend's computer running windows
Step 1: Get Access to Your Friend's Computer
In order to prank your friend, first you must get access to his/her computer. Wait for perfect moment when he/she will go to another room, and that's it, you have access to your friend's computer
Step 2: Open Hosts File
So now, after getting access to your friend's computer, create new folder on desktop and call it whatever you want, and open it, then open new window and go to following directory: C:/Windows/System32/drivers/etc/
This is where hosts file is located, now copy that file to new folder that you've made and double click it. It will ask using which software you would like to open it, choose notepad or any text editing software you prefer. Now you might have a question, why to copy hosts file to another folder and why to not edit it directly? Well, that's because, when you'll try to edit hosts file directly, windows system won't allow you to do so, so in order to overcome this, hosts file must be copied to another, non-protected directory (e.g. folder that we've made on desktop) see pictures for graphical instructions.
Step 3: Editing Hosts File
So, this is where you hack DNS, after opening hosts file (step 2), it would looks like this:
# Copyright (c) 1993-2009 Microsoft Corp.
# # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 184.108.40.206 rhino.acme.com # source server # 220.127.116.11 x.acme.com # x client host
# localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost
so as you can see everything inside that file is commented out. Now here's what you have to do:
as you may already know hosts file assigns ip addresses to their domains (see picture), so that means if you'll add domain (for example:) example.com and tell hosts file to assign some ip address to it (for example: 127.0.0.1), when user will open browser and type example.com, computer will automatically redirect him/her to website running on 127.0.0.1 . The way you do this in hosts looks like this: the domain which we are going to use is example.com and the ip of the site to which we are going to redirect users is 127.0.0.1, so to do this add this in hosts file:
127.0.0.1 example.com 127.0.0.1 www.example.com
it's important to add both domains: with www. and without it. after you finish click save.
(Note: if domain or IP address that you have entered doesn't exists, then it wouldn't work, use existing domains like google.com and etc, and IP's for example site ip which is running on localhosts, to get websites (like google.com) IP's see last step.)
Step 4: Replacing Hosts File
So, after you have done editing and saved hosts file in new folder, you have to replace system hosts file with your edited version, (IMPORTANT: Before doing this make sure that you've made a backup of old hosts file which is currently located in C:\Windows\System32\drivers\etc) to do this, right-click your edited version and click copy, then go back to C:\Windows\System32\drivers\etc and click paste button, windows will ask you to provide administrator permission, click Continue button and you're done. Now when you'll go to site which domain you have entered you will be redirected to site which IP address you have entered.
Step 5: Done!
So after you have finished everything, wait for your friend to come, when he/she will open browser and go to domain which you have entered in hosts file, he/she will be redirected to different site (site which ip address you have entered in hosts file), he/she would think that site is hacked or his/her computer is broken :). For better effect use site which your friend uses most frequently, he/she would start panic. Then after few minutes, tell him that you've pranked him.
Now to restore everything, take the backup file that you've made and replace hosts file in C:\Windows\System32\drivers\etc
If you don't have backup, dont worry, you can download it from here.
We hope you liked this tutorial, be sure to favorite, comment and follow. Thank you very much!
Step 6: Get IP Address of Site
In order to redirect to site you can't just enter it's domain, you have to enter it's IP. So how to get site's IP address? well that's pretty simple, all you have to do is to choose site which IP address you want and open Command Prompt (cmd.exe) and type this command:
ping [site domain e.g. google.com]
For example, if you want to find IP address of google.com type this command:
and you'll get response, which looks similar to this:
Pinging somesitewhichiknownothingabout.com [***.***.***.***] with 32 bytes of data:
inside  brackets is ip address of site, just write that IP down and that's it, you now have found site's IP address.
We have a be nice policy.
Please be positive and constructive.