Tuesday, 1 March 2016
0 comments

Generate Your Own Amalgamated Host Files

Generate Your Own Amalgamated Host Files

StevenBlack/hosts: A amalgamated Hosts Files


Amalgamated hosts file was last updated on February 26 2016, which contains 27,149 unique entries. The several reputable hosts file can be merged into a single amalgamated hosts file, and no duplicity is allowed. Using the Python script you can also download the amalgamated hosts file and clone this repo.


The main goal of amalgamated hosts file are:
  • Provide easy extensions.
  • De-dupe the resultant combined list.
  • Automatically combine high-quality lists of hosts.
  • Keep the resultant file reasonably sized.

With both additions and removals, a hosts source should be frequently updated, by its maintainers. If the hosts file is larger, then a higher level of curation is expected. On various Operating System, this amalgamated hosts file, will expect to serve both the mobile devices and the desktop.

Host files of the following locations are amalgamated.
  • The Adaway hosts file, updated regularly.
  • MVPs.org Hosts file at http://winhelp2002.mvps.org/hosts.htm, updated monthly, or thereabouts.
  • Dan Pollock at http://someonewhocares.org/hosts/ updated regularly.
  • Malware Domain List at http://www.malwaredomainlist.com/, updated regularly.
  • Peter Lowe at http://pgl.yoyo.org/adservers/, updated regularly.
  • My own small list in raw form here.

For generating your own amalgamated hosts file:

Based on the sources in local data/ subfolder, the updateHostsFile.py script will generate amalgamated hosts. The updateHostsFile.py script is compatible on python 2.7 and Python 3. There will be a script which prompts you that it will use the already existing hosts file ar fetch updated versions.

How to use it?

If you are using Python 3 then:
python3 updateHostsFile.py [--auto] [--replace] [--ip nnn.nnn.nnn.nnn] [--extensions ext1 ext2 ext3]

If you are using Python 2.7 then:
python updateHostsFile.py [--auto] [--replace] [--ip nnn.nnn.nnn.nnn] [--extensions ext1 ext2 ext3]


The Command line options is:
On using the command --auto, or -a: it run the script without prompting. When --auto is invoked, Host data sources, including extensions, are updated.

How to find which sources are amalgamated?
Just add additional sources by placing each in a subfolder of the data. A new hosts file copy is provided of that and place its update URL in update.info.

What is hosts file?
A plain text file which is used by all the Operating System in order to map hostnames to IP addresses. The hosts file is preferential to DNS, in many OS.

For example, to nullify requests to some doubleclick.net servers, adding these lines to your hosts file will do it:

# block doubleClick's servers
127.0.0.1 ad.ae.doubleclick.net
127.0.0.1 ad.ar.doubleclick.net
127.0.0.1 ad.at.doubleclick.net
127.0.0.1 ad.au.doubleclick.net
127.0.0.1 ad.be.doubleclick.net
# etc...

We recommend using 0.0.0.0 instead of 127.0.0.1

Location of your hosts file:
You can easily modify your current hosts file with a text editor. Mac OS X, iOS, Android, Linux: /etc/hosts folder.

Use the following command:
Windows: %SystemRoot%\system32\drivers\etc\hosts folder.

For reloading hosts file:
You can use the following commands to manually flush your DNS cache once the new hosts file is in place.

Open the terminal and run:
For Mac OS X
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder

For Windows open the command prompt:

Windows XP: Start -> Run -> cmd
Windows Vista, 7: Start Button -> type cmd -> right-click Command Prompt -> "Run as Administrator"
Windows 8: Start -> Swipe Up -> All Apps -> Windows System -> right-click Command Prompt -> "Run as Administrator"
and run:
ipconfig /flushdns

Open a Terminal and run with root privileges in Linus OS:

Debian/Ubuntu sudo /etc/rc.d/init.d/nscd restart



Image Source: Shutterstock

0 comments:

Post a Comment

 
Toggle Footer
Top