Host Files and You Non-profit and free for redistribution Written on March 19th | 2016 Published on March 19th | 2016 For entertainment and research purposes only ============================================== DISCLAIMER The Paranoid's Bible and its writers hold no responsibility for the acts of others. The Paranoid’s Bible is for research and entertainment purposes only. Please visit our blog for more PDFs and information: http://www.paranoidsbible.tumblr.com/ ============================================== Contents DISCLAIMER 2 Preface 4 Host Files and Their Use 5 Editing the Host File 6 Going Full Lazy 7 AFTERWORD 9 ============================================== Preface The who: People that have decided to combine their resources to create a repository of information. The what: A computer file used by an operating system to map hostnames to IP addresses. The where: %SystemRoot%\System32\drivers\etc\hosts The why: Block Ads, sites you don’t wish to be visited…etc ============================================== Host Files and Their Use In its simplicity, a host file (https://en.wikipedia.org/wiki/Hosts_(file)) is a file used by an OS to map hostnames and IP addresses. The file is plain text and is named hosts. Originally manually maintained and made available VIA file sharing by Stanford Research Institute (https://en.wikipedia.org/wiki/SRI_International) for the ARPANET (https://en.wikipedia.org/wiki/ARPANET) membership. It contained the hostnames and addresses of hosts as contributed for inclusion by member organizations. The DNS (https://en.wikipedia.org/wiki/Domain_Name_System), first described in 1983, automated the publication process and provided instant and dynamic resolution upon its implementation in 1984. Now, the host file is usually used as an alternative or as another layer of security. The file contains lines of text that usually consist of an IP address followed by a single host name or more. Comment lines also are included, though usually frowned upon due to being seen by adding excess waste to the file and increasing its size. An example of a host file, within Windows, usually looks like the below. ################################################################### ## This is an example HOSTS file created by ## ## www.bleepingcomputer.com. ## ## ## ## All entries in a HOSTS file must be in the format of: ## ## ## ## ipaddress hostname ## ## ## ## For example: ## ## ## ## 192.168.1.1 mycomputer.mydomain.com ## ## ## ## Notice that you must have a whitespace between the IP address ## ## and the hostname. Also keep in mind that the hostname can ## ## not contain any symbols like /,\,http://, etc. ## ## ## ## As a last note, you can the # symbol to make comments. Any ## ## line that starts with the # symbol will not be parsed by ## ## the operating system. You can therefore use this # symbol ## ## to make comments as seen below. ## ## ## ## Example valid entries found below. ## ################################################################### # The localhost entry should be in every HOSTS file and is used # to point back to yourself. 127.0.0.1 localhost # My test server for the website 192.168.1.2 test.bleepingcomputer.com #Blocking known malicious sites 127.0.0.1 admin.abcsearch.com 127.0.0.1 www3.abcsearch.com #[Browseraid] 127.0.0.1 www.abcsearch.com #[Restricted Zone site] ============================================== Editing the Host File Operating Systems have kept the host file alive and well, however they’re usually left untouched by the average computer and internet user. Depending on your OS, the location may vary, yet the host file and the process of editing will very little. For sake of using an example, we’ll go with Microsoft Windows and the location usually being something like: C:\Windows\System32\drivers\etc Once located, you simply right click the file and uncheck “read only” and then apply. This should allow you to now edit it, quite freely, through the use of your favorite word processor or editor. We recommend window’s built in notepad (https://en.wikipedia.org/wiki/Notepad_(software)) or our favorite, Sublime Text (https://www.sublimetext.com/) (The WinRAR of text editors). From there, you simply right click the file again and select “edit” from the drop down list or whatever editor or processor you wish to use. Now, before you start, please make a copy/backup of your host file and tuck it somewhere you won’t forget. Once the backup is made and you’re ready to edit your file, you can simply do so through the initial example of a loopback, which may look like this: 127.0.0.1 website This will block the website from being access on your system, once you save your host file. This means you can use the host file to block ads and malicious sites, which make editing and keeping your host file up-to-date a good practice. The blocked sites will not be accessible, at all, on the machine that houses the edited host file. You can also use this method as a means to prevent people from visiting certain sites that you don’t wish anyone within your household or business to visit. So, parents, take note of this. Before we continue onto our next chapter, we wish to simply note that you don’t need to edit the host file, yourself, nowadays thanks to a single program that we’ll mentioning in the next chapter. You’ll only ever need to edit the host file, yourself, if you wish to block a specific site. There are also numerous sites that you can follow or subscribe to that offer host files for download, but we don’t recommend this. ============================================== Going Full Lazy Because many people expect a one-button solution, we’ll forego an entire chapter on what sites to follow or subscribe to, and simply list a useful program for you to use that’ll help keep your host file up-to-date and loaded with all kinds of goodies. Below is the program to download. The Program 1. Hostman (http://www.abelhadigital.com/hostsman) To install, you simply go to the site (http://www.abelhadigital.com/hostsman) and download the zip file. From there, you unzip it and click the .exe to install the file. Once the file is up and running and you ensured to untick the “Read only” attribute of your host file, you can now setup and update your host file. Before we begin, double-check you’ve right clicked and activated hostman VIA “Run as Administrator”. If any options are grayed out, check the site’s FAQs (http://www.abelhadigital.com/support/faq). When you startup Hostman for the first time, it’ll ask you if you wish to select sources, possibly. Ensure you check: MVPS Hosts; hpHosts; hpHosts (partial); Peter Lowe's Adsever list; Cameleon; Malware Domain list. Once you’ve selected your hosts, or added your preferred host, click close and hit update. After a few seconds or minutes your host file has now been updated. To ensure its stability and lower the overall size, click the “edit” drop down menu and hit the options at any order you want, however we recommend doing it thus: Scan Host file...; Find Duplicates...; Delete comments. Now click the “Replace IP” option and select “127.0.0.1 -> 0.0.0.0”. The reason for this is that 127.0.0.1 is the “local host” whereas 0.0.0.0 is a non-routable meta-address that’s mainly used to designate an invalid or unknown target/site. Supposedly doing 0.0.0.0 instead of 127.0.0.1 will help relieve a constant pressure put onto your connection or some such other technological magic that we’ll let you read up on at another resource (http://www.howtogeek.com/225487/what-is-the-difference-between-127.0.0.1-and-0.0.0.0/). Finally hit the “Rearrange Hosts” option and select “1” for the number of hosts per line and tick “Delete comments”. Hit continue and you’re done. Congratulations, you blocked several hundred malicious sites and trackers. Feels good to have this layer, doesn’t it? ============================================== AFTERWORD Closest you’ll ever get to a one button solution from the PB.