-
-
Save peshi/77fd8a1ee1635030e02a to your computer and use it in GitHub Desktop.
blocking p2p peer snoopers and evil corp (for Tixati IP filter and such)
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/sh | |
# This script runs every other night at 04:56 CET on a webserver I maintain | |
# Results are always at: https://jult.net/block.txt ( or https://jult.net/block.txt.gz ) | |
# And much smaller, stripped of BS; https://jult.net/bloc.txt | |
# For use in Tixati IP filter: https://jult.net/bloc.txt.gz | |
# And finally a txt file with just the bold IP-ranges: https://jult.net/bl.txt (or https://jult.net/bl.txt.gz ) | |
# Download open block-lists, unpack, filter: | |
curl -s https://www.iblocklist.com/lists.php | grep -A 2 Bluetack | xargs wget -qO - --limit-rate=500k | gunzip -f | egrep -v '^#' > /tmp/xbp | |
# Assholes allowing kiddy-porn, uncomment if you are prepared to deprive yourself of speedy (non-porn) downloads as well, | |
# for a good cause: | |
#cd /tmp | |
#wget -q --trust-server-names http://list.iblocklist.com/?list=dufcxgnbjsdwmwctgfuj&fileformat=p2p&archiveformat=gz | |
#sleep 4 | |
#cd /tmp | |
#gunzip duf*.gz | |
#cat /tmp/duf* >> /tmp/xbp | |
# and another list: | |
wget -qO - --limit-rate=500k http://www.wael.name/wael.list.p2p.gz > /tmp/xb2.gz | |
gunzip -f /tmp/xb2.gz | |
cat /tmp/xb2 >> /tmp/xbp | |
# and another | |
wget -qO - --limit-rate=500k http://john.bitsurge.net/public/biglist.p2p.gz > /tmp/xb3.gz | |
gunzip -f /tmp/xb3.gz | |
cat /tmp/xb3 >> /tmp/xbp | |
# and the up to date bogon lists, these also often adversely affect speed, often generate false positives | |
# but if you're paranoid, use these as well | |
#wget -q http://www.team-cymru.org/Services/Bogons/fullbogons-ipv4.txt -O /tmp/xbogons | |
#wget -q http://www.team-cymru.org/Services/Bogons/bogon-bn-agg.txt -O /tmp/xblocal | |
# Strip, Sort and Delete doubles: | |
sed -i "s/[[:space:]]*#.*$//g" /tmp/xbp | |
sed -i "s/.*value='\(http:.*\)'.*/\1/p" /tmp/xbp | |
sort /tmp/xbp | uniq -u > /ramd/jult/block.txt | |
# Strip everything but IPv4s (and ranges), for use in firewalls etc. | |
grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}$|([0-9]{1,3}\.){3}[0-9]{1,3}\-([0-9]{1,3}\.){3}[0-9]{1,3}' /ramd/jult/block.txt > /tmp/xbl | |
# finally, add bogon list | |
#cat /tmp/xbogons >> /tmp/xbl | |
sort /tmp/xbl | uniq -u > /ramd/jult/bl.txt | |
# remove local networks from bogon list | |
#comm -23 /tmp/xbl.txt /tmp/xblocal > /ramd/jult/bl.txt | |
# Beautyfi for tixati pulling, add colon in front | |
sed "s/^/:/g" /ramd/jult/bl.txt > /ramd/jult/bloc.txt | |
# Keep as txt and gz file: | |
gzip -c /ramd/jult/block.txt > /ramd/jult/block.txt.gz | |
gzip -c /ramd/jult/bloc.txt > /ramd/jult/bloc.txt.gz | |
gzip -c /ramd/jult/bl.txt > /ramd/jult/bl.txt.gz | |
# Let's make sure next run is a clean one | |
rm -rf /tmp/xb* | |
#rm -rf /tmp/du* | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment