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"
|
|
|
|
|
2017-05-11 18:36:52 +03:00
|
|
|
ZREESTR=$TMPDIR/zapret.txt
|
|
|
|
ZDIG=$TMPDIR/zapret-dig.txt
|
|
|
|
ZIPLISTTMP=$TMPDIR/zapret-ip.txt
|
2018-04-19 13:19:13 +03:00
|
|
|
#ZURL=https://reestr.rublacklist.net/api/current
|
|
|
|
ZURL=https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv
|
2016-02-15 16:34:45 +03:00
|
|
|
|
2016-03-16 08:33:26 +03:00
|
|
|
getuser
|
2016-02-15 16:34:45 +03:00
|
|
|
|
2019-05-07 18:59:57 +03:00
|
|
|
curl -k --fail --max-time 300 --max-filesize 62914560 "$ZURL" >"$ZREESTR" ||
|
2018-04-19 13:19:13 +03:00
|
|
|
{
|
|
|
|
echo reestr list download failed
|
|
|
|
exit 2
|
2016-02-15 16:34:45 +03:00
|
|
|
}
|
2018-04-19 13:19:13 +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
|
|
|
|
echo preparing dig list ..
|
|
|
|
#sed -i 's/\\n/\r\n/g' $ZREESTR
|
|
|
|
#sed -nre 's/^[^;]*;([^;|\\]{4,250})\;.*$/\1/p' $ZREESTR | sort | uniq >$ZDIG
|
2019-05-07 18:59:57 +03:00
|
|
|
cut -f2 -d ';' "$ZREESTR" | grep -avE '^$|\*|:' >"$ZDIG"
|
|
|
|
rm -f "$ZREESTR"
|
2018-04-19 13:19:13 +03:00
|
|
|
echo digging started ...
|
2019-05-07 18:59:57 +03:00
|
|
|
digger "$ZDIG" | cut_local >"$ZIPLISTTMP" || {
|
|
|
|
rm -f "$ZDIG"
|
2018-04-19 13:19:13 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2019-05-07 18:59:57 +03:00
|
|
|
rm -f "$ZDIG"
|
|
|
|
sort -u "$ZIPLISTTMP" | zz "$ZIPLIST"
|
|
|
|
rm -f "$ZIPLISTTMP"
|
2018-04-19 13:19:13 +03:00
|
|
|
"$EXEDIR/create_ipset.sh"
|