Howto: Add blocklists using a parsing script (i.e. Easylist)

This howto applies to the current version of Pi-Hole.

A topic how to add additional blocklists can be found here: How do I add additional block lists to Pi-hole? Mentioned there is that some lists require additional parsing.

Below step-by-step how to create a custom script which runs as a daily cronjob, and formats the source lists to domains only for Pi-Hole to digest. First you need to ssh into the device running Pi-Hole.

Start by creating a new cron (as root):

sudo -i
-enter password if required-
nano /etc/cron.daily/easylist

Paste following code:

 # download adblock lists
 curl -s -L https://easylist-download...g/malwaredomains_full.txt > adblock.unsorted

 # look for: ||domain.tld^
 sort -u adblock.unsorted | grep ^\|\|.*\^$ | grep -v \/ > adblock.sorted

 # remove extra chars
 sed 's/[\|^]//g' < adblock.sorted > /var/www/html/pihole/adblock.hosts

 # remove files we no longer need
 rm adblock.unsorted adblock.sorted

After pasting, continue with the following:

CTRL+X -> Y -> Enter
chmod +x /etc/cron.daily/easylist\
nano /etc/pihole/adlists.list

Add at the bottom of adlists.list:

CTRL+X -> Y -> Enter

The script can be tested by:

sudo -i
cd /etc/cron.daily/
pihole -g

If all did go well, pihole -g outputs a succesfull retrieval of the new lists and has added it to the collection of blocked domains. It is possible to add more lists requiring parsing in the script after curl -s -L, separated by a space.

A collection of lists:

1 Like

I feel like somebody could parse these and upload lists to github