Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Windows (http://www.go4expert.com/articles/windows/)
-   -   Hacking the hosts file in windows (http://www.go4expert.com/articles/hacking-hosts-file-windows-t20282/)

neo_vi 5Dec2009 19:08

Hacking the hosts file in windows
 

INTRODUCTION



Many of us would have used a local webserver for designing websites or for previewing. This is where the 'localhost' comes. We always give http://localhost or http://127.0.0.1 to tell the browser to take the files from the local web server instead of going into the internet. How and where to change that name, if u wanted to make the localhost as .com or .net, whatever.
Just edit the file named hosts under the location
'C:\WINDOWS\system32\drivers\etc\hosts' (assuming C: is the drive where u installed windows)
A default hosts file will look like this

Code:

# Copyright (c) 1993-1999 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:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
 
127.0.0.1 localhost

Change the last line to whatever name u like.
e.g
Code:

127.0.0.1 xyz.com
Use the name xyz.com instead of localhost while using the local webserver.

This file can also be used to block unwanted sites. U can put the sites here that u don't wish to see.
e.g
Code:

127.0.0.1 dont-see-this.com

How the above line works?



If you go to a particular URL in the browser the OS will check the hosts file whether any specific address has been mapped to that site.If yes it will load that,if not it will fetch it from the web. If you give the above line in the hosts file, whenever u goto the site 'dont-see-this.com' it will point the browser to the address 127.0.0.1 which is your localhost.
(The above technique is used in 'spybot search and destroy' when u give the immunize option)
Happy hacking! :D

shabbir 6Dec2009 10:21

Re: Hacking the hosts file in windows
 
Same process is used by many virus to block the anti virus sites and that means you cannot update your anti-virus thus preventing the removal of virus

pankaj.sea 6Dec2009 21:38

Re: Hacking the hosts file in windows
 
Hi neo_vi
There was a small mistake in your article, the path of "hosts" file will be
Quote:

C:\WINDOWS\system32\drivers\etc\hosts
not
Quote:

C:\WINDOWS\system32\etc\hosts
Thanks...
;)

venami 6Dec2009 22:14

Re: Hacking the hosts file in windows
 
Nice info neo_vi.

And in Linux, the same can be done in /etc/hosts file.

neo_vi 7Dec2009 10:25

Re: Hacking the hosts file in windows
 
Quote:

Originally Posted by pankaj.sea (Post 61274)
Hi neo_vi
There was a small mistake in your article, the path of "hosts" file will be not
Thanks...
;)

Oh. I am sorry. Thanks for letting me know. It happened cos i didn't copy the path, i typed it instead.

>>> for shabbir,
can u please make the above change in the article.?

shabbir 7Dec2009 18:21

Re: Hacking the hosts file in windows
 
Done.

technica 18Dec2009 12:25

Re: Hacking the hosts file in windows
 
Good one. I have already used it some times, but with this article I understood how it works.

shabbir 3Jan2010 23:31

Re: Hacking the hosts file in windows
 
Nominate this article for Article of the month - Dec 2009


All times are GMT +5.5. The time now is 13:54.