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-downloads.adblockplus.org/easylist.txt 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:

http://127.0.0.1/pihole/adblock.hosts

CTRL+X -> Y -> Enter
exit

The script can be tested by:

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

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: https://www.reddit.com/r/pihole/comments/4p2tp7/adding_easylist_and_other_adblocklike_sources_to/

1 Like

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