2016-02-15 16:34:45 +03:00
|
|
|
#!/bin/sh
|
|
|
|
# get rublacklist and resolve it
|
|
|
|
|
|
|
|
SCRIPT=$(readlink -f $0)
|
|
|
|
EXEDIR=$(dirname $SCRIPT)
|
|
|
|
|
|
|
|
. "$EXEDIR/def.sh"
|
|
|
|
|
|
|
|
ZREESTR=/tmp/zapret.txt
|
|
|
|
ZDIG=/tmp/zapret-dig.txt
|
|
|
|
ZIPLISTTMP=/tmp/zapret-ip.txt
|
|
|
|
ZURL=http://reestr.rublacklist.net/api/current
|
|
|
|
|
2016-03-16 08:33:26 +03:00
|
|
|
getuser
|
2016-02-15 16:34:45 +03:00
|
|
|
|
2017-05-06 09:47:30 +03:00
|
|
|
curl --fail --max-time 300 --max-filesize 41943040 "$ZURL" >$ZREESTR && {
|
2016-02-15 16:34:45 +03:00
|
|
|
dlsize=$(wc -c "$ZREESTR" | cut -f 1 -d ' ')
|
|
|
|
if test $dlsize -lt 204800; then
|
|
|
|
echo list file is too small. can be bad.
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
sed -i 's/\\n/\r\n/g' $ZREESTR
|
|
|
|
sed -nre 's/^[^;]*;([^;|\\]{4,250})\;.*/\1/p' $ZREESTR | sort | uniq >$ZDIG
|
|
|
|
rm -f $ZREESTR
|
|
|
|
echo digging started ...
|
2017-03-24 08:39:13 +03:00
|
|
|
dig A +short +time=8 +tries=2 -f $ZDIG | grep -E '^[^;].*[^\.]$' | grep -vE '^192\.168\.[0-9]+\.[0-9]+$' | grep -vE '^127\.[0-9]+\.[0-9]+\.[0-9]+$' | grep -vE '^10\.[0-9]+\.[0-9]+\.[0-9]+$' >$ZIPLISTTMP || {
|
2016-02-15 16:34:45 +03:00
|
|
|
rm -f $ZDIG
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
rm -f $ZDIG $ZIPLIST
|
|
|
|
sort $ZIPLISTTMP | uniq >$ZIPLIST
|
|
|
|
rm -f $ZIPLISTTMP
|
|
|
|
"$EXEDIR/create_ipset.sh"
|
|
|
|
}
|