zapret/ipset/get_antizapret.sh

24 lines
656 B
Bash
Raw Normal View History

2016-02-22 14:54:18 +00:00
#!/bin/sh
# get ip list from antizapret.prostovpn.org
SCRIPT=$(readlink -f $0)
EXEDIR=$(dirname $SCRIPT)
. "$EXEDIR/def.sh"
2016-11-07 15:01:23 +00:00
ZURL=https://github.com/zapret-info/z-i/raw/master/dump.csv
2016-02-22 14:54:18 +00:00
ZIPLISTTMP=/tmp/zapret-ip.txt
2016-03-16 05:33:26 +00:00
getuser
2016-02-22 14:54:18 +00:00
2016-11-07 15:01:23 +00:00
curl --fail --max-time 60 --max-filesize 33554432 -k -L "$ZURL" | sed -nre "s/([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/\1\n/gp" | sed -nre "s/^[^0-9]*([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*$/\1/p" >$ZIPLISTTMP &&
2016-02-22 14:54:18 +00:00
{
dlsize=$(wc -c "$ZIPLISTTMP" | cut -f 1 -d ' ')
if test $dlsize -lt 20480; then
echo list file is too small. can be bad.
exit 2
fi
mv -f $ZIPLISTTMP $ZIPLIST
"$EXEDIR/create_ipset.sh"
}