Hosts: list with dnsmasq

Created on 18 Mar 2017  路  7Comments  路  Source: StevenBlack/hosts

hello,
can we also have lists for dnsmasq /dnsmasq with server?
or can anyone help me how to convert the hosts file to dnsmasq?

All 7 comments

I have a project that converts the standard Unified Hosts File (adware + malware) to dnsmasq/bind formats which might help.

https://github.com/oznu/dns-zone-blacklist

You could also use the hosts file in dnsmasq directly.

Alternatively, to do this via shell you can use something like this:
wget -O- insert LINK to the file you choose | awk '$1 == "0.0.0.0" { print "address=/"$2"/0.0.0.0/"}' > /etc/dnsmasq.d/malware.conf

example:
wget -O- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | awk '$1 == "0.0.0.0" { print "address=/"$2"/0.0.0.0/"}' > /etc/dnsmasq.d/malware.conf
you could also use that line in a cron job to have it run periodically

Don't forget to print an extra line for IPv6, per #47. I use this script, although @erlepereira's script uses awk more elegantly and I may update mine accordingly. 馃槃

As mentioned in #47, can someone draft something for the "Interesting Applications" section on this so this issue can be closed?

@ScriptTiger I believe the nxdomain variants of @oznu's repo should handle both ipv4 and ipv6 without any additional configuration. At least, this is true of nxdomain behaviour under BIND9 and Unbound on Fedora and OpenBSD.

@ScriptTiger I have created a quick gist with some notes and a script file I use in cron to achieve the above in dnsmasq
gist -- https://gist.github.com/erlepereira/c11f4f7a3f60cd2071e79018e895fc8a

I could add more if needed, but I think it would suffice for the 'Interesting Applications" section. Let me know if more would be required.

That's up to Steven. I think recently he has been leaning towards supporting different formats internally, as he referenced in https://github.com/StevenBlack/hosts/issues/434. But as we don't really offer any Python script support or a README reference at the moment, I'm sure a PR for either would be welcomed at this point since we definitely get enough issues about it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sego1234 picture Sego1234  路  3Comments

mueller-ma picture mueller-ma  路  3Comments

beerisgood picture beerisgood  路  3Comments

Laicure picture Laicure  路  3Comments

onmyouji picture onmyouji  路  3Comments