-
-
Save hunterkepley/c0c54308b3d111d4ca3528a2b612e244 to your computer and use it in GitHub Desktop.
update-blocklist-pihole
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# vars | |
src=/home/pi/src | |
#in=$src/in | |
out=$src/out | |
rawout=$out/combined.raw | |
procout=$out/combined.processed | |
srclist=$src/src.list | |
pihole=/etc/pihole | |
# pull raw in files from sources | |
# clean out old file first | |
[[ -f $rawout ]] && rm $rawout | |
for s in $(cat $srclist | grep -v "^#") | |
do | |
curl $s >>$rawout | |
done | |
# now prepare the rawout formating for pihole | |
[[ -f $procout ]] && rm $procout | |
cat $rawout | egrep -v "^!" |sed 's/^||//' |cut -d'^' -f-1 >>$procout | |
# now add to pihole's blacklist | |
cat $pihole/blacklist.txt >> $procout | |
# sort unique | |
sort -u $procout > $out/blacklist.txt2 | |
sudo rm $pihole/blacklist.txt | |
sudo mv $out/blacklist.txt2 $pihole/blacklist.txt | |
pihole -g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment