About Us

Maxycore IT Consultatnts is an indigenous Technology solutions company with a competent and reliable pool of experts in various ICT disciplines from Infrastructure design and administration to web development, graphics design/animation, software and application programming, search engine optimization, voice and telephony solution, etc committed to providing technological solutions to small businesses in Nigeria. We are registered with the CAC - RC 2723246. Visit us at www.maxycore.net and let us know how we can be of service.
© Maxycore IT Consultants. Powered by Blogger.

Wednesday, 21 September 2016

Do It Yourself Internet Filter


HOW TO TO SET UP YOUR OWN INTERNET FILTER

Restrict Access To Select Websites on Your Windows PC

DISCLAIMER: Advanced level computer users and higher nerds will most likely find this easy and very helpful. The same cannot be said for beginner level users. MaxyCorp cannot be held liable for any time you may waste actually attempting this; any damage - programmatically or physically out of frustration - you may inflict upon your computer hardware after becoming angry at how out of the way this process actually is; and any operating system or software problems that may arise from toying with your Windows Host File. 
It goes without saying that you continue these steps ON YOUR OWN (O.Y.O.)

1. Locate the Windows hosts file

Depending on which operating system is running on your computer, you will find the host file (most often called 'hosts') here:
  • Windows 2000 -- C:\WINNT\system32\drivers\etc\
  • Windows XP/Vista/7/8/10 -- C:\WINDOWS\system32\drivers\etc\
  • Windows Mobile -- Registry key under HKEYLOCALMACHINE/Comm/TcpipHosts
A Little Background on the hosts file:
The Windows hosts file is a VERY IMPORTANT file. The hosts file is a plain text computer file used by an operating system to map hostnames to IP addresses. Simply put, it tells the local computer which IP address to use in searching the network (both local and Internet) for hostnames.

2. Backup your hosts file

It is always good practice to backup a file you are about to work on. This way you can always revert to it's original form should your attempt at being a techy today result in an otherwise planned catastrophe. Simply select the hosts  file, copy (by pressing CTRL + C) and then paste (by pressing CTRL + V). If your version of Winodws is the same as ours, you should have a hosts - Copy file appear.

3. Open your host file

To do this, you need a basic text editor. Forget Microsoft Office or Open Office or any other such editing applications. They most likely would add characters (both hidden and otherwise) to the file and we do not want that. Remember what we said about the hosts file? I would recommend you download Notepadd++ for this. This is a very useful text editor for for editing application files.

A screenshot of my Windows hosts file


4. Understand Your hosts file

In the screenshot above, you would notice that every line up to line 21 is preceded with a #. This tells the computer that everything on that line is a comment and is to be ignored. in simple programming ethics, they were put there by the author of a file to explain the content of the file or used to temporarily disable a line of code on the file.
In my hosts file above, only lines 23 and 24 are active. Lines 23 and 24 tells the computer to look for any host named "localhost" at IP address 127.0.0.1. The origin and meaning of the terminology "localhost" and the IP address 127.0.0.1 (also called loop-back address) would not be addressed in this post. Simply put, lines 23 and 24 tells me that my computer address itself as "localhost" and can locate itself at 127.0.0.1. Any other host name that is not listed in the hosts file is resolved using the Domain Naming System of the network. In other words, when the computer wants to locate "localhost", it uses the listing in the hosts file to point to 127.0.0.1 but when it wants to locate facebook.com it queries the DNS for the IP address of facebook.com since it isn't listed in the hosts file.
Forcing the Computer to Resolve Facebook.com at 127.0.0.1

What if we list facebook.com as 127.0.0.1? Feeling naughty yet?! Hehehehehe... 
Since the hosts file takes precedence, that would mean the computer would be looking to resolve facebook.com at 127.0.0.1 which would result in a "Connection Failed" response form the web browser.
Facebook.com can no longer be accessed from my Computer

5. Translate the web address you want to block to host file-friendly format

Ordinarily, you may want to block certain website categories like pornography or video streaming or downloads or torrents, etc... Make a list of as many as you want to - all 3 million+ website domain names as listed by Google - and add them to the hosts file in the exact manner of lines 23 and 24 of the screenshot in 3 above. Be sure to enter 127.0.0.1 and then use either the TAB or SPACE bar to go to column where "localhost" is before typing out the domain name you want to block.
Enter domain names as blockthissite.com not www.blockthissite.com.
Every domain name (hostname) should be entered on a different line.
Every entry must align with the previous in other to not to result in any errors when the computer tries to interpret the file.
Repeat as many times as you have websites to block. 

6. Save your host file

If you are using Notepad++ simply press CTRL + S to save the file. Sometimes,your computer may stop responding it may take some time for the computer to wake up (after all, you are trying to hack the computer). 
Your antivirus program may also throw up a bunch of warnings that a malware is trying to modify sensitive files on your computer. Understand that YOU are the malware and do not chose the default action to delete or quarantine the file being modified. Simply disbale your antivirus program temporarily until you are done.

7. Backup your saved file

Select All the text in your newly edited hosts file and COPY. Then open a new document in your text editor (notepad++). PASTE the content. Save this new file as newhostsbackup.txt in a different location - preferably, in My Documents. This saves your new hosts file in text file format in a different name especially if you have entered a bunch of websites and have better things to do than repeat the process again because of some fluke.

8. Enjoy your new internet filter

As soon as the file is saved, you can go ahead and try accessing any of the websites you entered into the hosts file and you would be pleasantly presented with a page that simply says - Page Not Found.

0 comments:

Post a Comment