Last week, I’ve been playing a lot of my local PC and my development computer. Sometimes we need to replicate everything from server to local. You know what I mean?
Anyways, this is very useful when you have a client abroad and that they gave you an assignment with very limited control. In this post, I’ll make an example of a website which has a third-party component which is bought by your client and license is locked-in by domain name.
Now you think that “how the heck I’m supposed to use those components locally?”. Answer is “your host file”. You ask again, “What is it to do with my host file?”. Well, its easy. I don’t have time to explain more about the OS host file but know this:
The host file is a system file that will be called by your system whenever you’re trying to requests a domain on the internet before a DNS request is requested to your router and router to routers… and in to the root zones. Well, you don’t have to know all those stuff. For this post, I’d like to make an example on why this file is important.
First, you have to know some things. For windows, it usually resides in C:\WINDOWS\system32\drivers\etc\hosts. By typing “drivers” in your Start > Run, you will be redirected to C:\WINDOWS\system32\drivers.
For linux, its in /etc/hosts. This file will not appear in windows if you don’t have network adapter installed.
So how does it look like? well, it should have an entry something like this:
127.0.0.1 localhost 127.0.0.1 mpa.one.microsoft.com
for windows and are very identical to linux and most unix systems.
Now, if we’re going to add an entry there say mydomain.com with an ip address of our own, all requests to “mydomain.com” will be mapped to that of our own ip address. Whenever any programs like your browser, IM clients, torrents and others will make requests to the internet, it will consult your host file first.
So back to our third-party component. Let’s assume we have downloaded all the files for website.com from your client, all you have to do is make an entry of website.com and put your local ip address with it. So it should look something like this.
127.0.0.1 localhost 127.0.0.1 mpa.one.microsoft.com 127.0.0.1 website.com
Now, let’s try your third-party components if it works. This solution is not applicable to components that are locked by ip address. So don’t comment about it. 😛
The host file draws many solutions to our problems and are very handy for making hacks like this one. Also, some viruses and trojans are making use of this.
For the sake of others, I’d extend this post to something different. We know that we had the internet crowded with spams nowadays. Commonly happens in the internet wherein we sent e-mails everyday, we receive newsletters everyday, we register to a new website everyday… to name a few. Now we can fall as a victim to this. Now remember this: “make sure you’re visiting a website with the proper url in your browser”. Remember to read e-mail with caution. Don’t read mails you don’t know. Make sure you don’t get ip address like 12.13.243.24 in your browsers address but you see paypal website. Check your host file regularly. Make sure there’s no strange entries like 172.12.33.4 ip1.otherhackergroup.com
That’s it for now and please do leave a message if you have something to ask. Thanks!
…