This specification proposes a free software tool to build a hosts file.
The tool reads its configuration from a file in a format called Innie, an INI-like format also used by the Action 53 ROM builder.
(We reject Python's similar configparser
module for lack of explicit support for duplicate sections and keys.)
The [options]
section contains settings that control the entire output.
All can be overridden on the command line.
output=filename
; command line: -o filename
, --output filename
-
(a single hyphen) denotes standard output. Default is -
.hosts-per-line=count
; command line: -n count
, --hosts-per-line count
map-to=ip
; command line: --map-to ip
0.0.0.0
, but some computer security tools reportedly need 127.0.0.1
.The [sources]
section lists sources from which to build a blacklist. Each must begin with source=
, which gives the source a title. Each must also include a format=
and a path=
in the local file system.
url=
)urllib
module supports.expires=
)url
into the path
. Value is a positive whole number followed by minute
, minutes
, hour
, hours
, day
, or days
. Default is 7 days
.Example config file:
# Example configuration file # command line switches can override these options [options] output = hosts hosts-per-line = 5 map-to=0.0.0.0 [sources] source=Local Test Server path =test_servers.txt format=hosts map-to=127.0.0.1 source=Staging Test Servers path =test_servers.txt format=hosts action=none source=Popular Sites path =popular_sites.txt format=hostnames action=resolve source=Known Trackers path =trackers.txt format=hostnames source=MVPS path =mvps_hosts.txt url =http://winhelp2002.mvps.org/hosts.txt expires=7 days format=hosts
The tool receives blacklist and whitelist sources in two formats:
format=host
or format=hosts
)format=hostname
or format=hostnames
)In both hosts files and hostname files, a line whose first nonblank character is the pound sign (#
) is a comment and thus ignored.
The tool can do any of several things with the data loaded from a file:
action=
)action=blacklist
, action=map-to
, or map-to=
)0.0.0.0
. This is the default for hostname files.action=resolve
or action=whitelist
)socket.getaddrinfo(hostname, 80)
. This is good for whitelisting your most commonly visited websitesaction=none
, action=ignore
)Categories: Computer security