Advertisement
paranoidsbible

Host Files and You

Feb 21st, 2017
3,216
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.28 KB | None | 1 0
  1. Host Files and You
  2.  
  3. Non-profit and free for redistribution
  4. Written on March 19th | 2016
  5. Published on March 19th | 2016
  6.  
  7. For entertainment and research purposes only
  8. ==============================================
  9.  
  10.  
  11. DISCLAIMER
  12. The Paranoid's Bible and its writers hold no responsibility for the acts of others.
  13.  
  14. The Paranoid’s Bible is for research and entertainment purposes only.
  15.  
  16. Please visit our blog for more PDFs and information: http://www.paranoidsbible.tumblr.com/
  17. ==============================================
  18.  
  19.  
  20. Contents
  21. DISCLAIMER 2
  22. Preface 4
  23. Host Files and Their Use 5
  24. Editing the Host File 6
  25. Going Full Lazy 7
  26. AFTERWORD 9
  27. ==============================================
  28.  
  29.  
  30. Preface
  31. The who:
  32. People that have decided to combine their resources to create a repository of information.
  33.  
  34. The what:
  35. A computer file used by an operating system to map hostnames to IP addresses.
  36.  
  37. The where:
  38. %SystemRoot%\System32\drivers\etc\hosts
  39.  
  40. The why:
  41. Block Ads, sites you don’t wish to be visited…etc
  42. ==============================================
  43.  
  44.  
  45. Host Files and Their Use
  46.  
  47. 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.
  48.  
  49. Now, the host file is usually used as an alternative or as another layer of security.
  50.  
  51. 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.
  52.  
  53. An example of a host file, within Windows, usually looks like the below.
  54.  
  55. ###################################################################
  56. ## This is an example HOSTS file created by ##
  57. ## www.bleepingcomputer.com. ##
  58. ## ##
  59. ## All entries in a HOSTS file must be in the format of: ##
  60. ## ##
  61. ## ipaddress hostname ##
  62. ## ##
  63. ## For example: ##
  64. ## ##
  65. ## 192.168.1.1 mycomputer.mydomain.com ##
  66. ## ##
  67. ## Notice that you must have a whitespace between the IP address ##
  68. ## and the hostname. Also keep in mind that the hostname can ##
  69. ## not contain any symbols like /,\,http://, etc. ##
  70. ## ##
  71. ## As a last note, you can the # symbol to make comments. Any ##
  72. ## line that starts with the # symbol will not be parsed by ##
  73. ## the operating system. You can therefore use this # symbol ##
  74. ## to make comments as seen below. ##
  75. ## ##
  76. ## Example valid entries found below. ##
  77. ###################################################################
  78.  
  79. # The localhost entry should be in every HOSTS file and is used
  80. # to point back to yourself.
  81.  
  82. 127.0.0.1 localhost
  83.  
  84. # My test server for the website
  85.  
  86. 192.168.1.2 test.bleepingcomputer.com
  87.  
  88. #Blocking known malicious sites
  89. 127.0.0.1 admin.abcsearch.com
  90. 127.0.0.1 www3.abcsearch.com #[Browseraid]
  91. 127.0.0.1 www.abcsearch.com #[Restricted Zone site]
  92. ==============================================
  93.  
  94.  
  95. Editing the Host File
  96.  
  97. 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.
  98.  
  99. For sake of using an example, we’ll go with Microsoft Windows and the location usually being something like: C:\Windows\System32\drivers\etc
  100.  
  101. 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).
  102.  
  103. 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.
  104.  
  105. 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
  106.  
  107. 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.
  108.  
  109. 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.
  110.  
  111. 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.
  112. ==============================================
  113.  
  114.  
  115. Going Full Lazy
  116.  
  117. 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.
  118.  
  119. Below is the program to download.
  120. The Program
  121. 1. Hostman (http://www.abelhadigital.com/hostsman)
  122.  
  123.  
  124. 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.
  125.  
  126. 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).
  127.  
  128. 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.
  129.  
  130. 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.
  131.  
  132.  
  133.  
  134. 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/).
  135.  
  136. 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.
  137.  
  138. Congratulations, you blocked several hundred malicious sites and trackers.
  139.  
  140. Feels good to have this layer, doesn’t it?
  141. ==============================================
  142.  
  143.  
  144. AFTERWORD
  145.  
  146. Closest you’ll ever get to a one button solution from the PB.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement