first commit

This commit is contained in:
bolvan
2016-02-15 16:34:45 +03:00
commit 7443de517a
29 changed files with 9416 additions and 0 deletions

25
ipset/create_ipset.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
# create ipset from resolved ip's
SCRIPT=$(readlink -f $0)
EXEDIR=$(dirname $SCRIPT)
. "$EXEDIR/def.sh"
TEMPIPSET=/tmp/ipset.$ZIPSET.tmp
ipset flush $ZIPSET || ipset create $ZIPSET hash:ip
for f in "$ZIPLIST" "$ZIPLIST_USER"
do
[ -f $TEMPIPSET ] && rm -f $TEMPIPSET
[ -n "$f" ] && {
echo Adding $f
sort $f | uniq | while read ip;
do
echo add $ZIPSET $ip >>$TEMPIPSET
done
ipset -! restore <$TEMPIPSET 2>&1
rm -f $TEMPIPSET
}
done

4
ipset/def.sh Executable file
View File

@@ -0,0 +1,4 @@
ZIPLIST=$EXEDIR/zapret-ip.txt
ZIPLIST_USER=$EXEDIR/zapret-ip-user.txt
ZIPSET=zapret
ZUSERLIST=$EXEDIR/zapret-hosts-user.txt

34
ipset/get_reestr.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/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
$EXEDIR/get_user.sh
curl --fail --max-time 60 --max-filesize 10485760 "$ZURL" >$ZREESTR && {
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 ...
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 || {
rm -f $ZDIG
exit 1
}
rm -f $ZDIG $ZIPLIST
sort $ZIPLISTTMP | uniq >$ZIPLIST
rm -f $ZIPLISTTMP
"$EXEDIR/create_ipset.sh"
}

11
ipset/get_user.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# resolve user host list
SCRIPT=$(readlink -f $0)
EXEDIR=$(dirname $SCRIPT)
. "$EXEDIR/def.sh"
[ -f $ZUSERLIST ] && {
dig A +short +time=8 +tries=2 -f $ZUSERLIST | 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]*$' | sort | uniq >$ZIPLIST_USER
}

View File

@@ -0,0 +1,5 @@
st.kinozal.tv
s.kinozal.tv
static.rutracker.org
static2.rutracker.org
bt.rutracker.org

5
ipset/zapret-ip-user.txt Normal file
View File

@@ -0,0 +1,5 @@
195.60.77.222
195.82.146.120
195.82.146.216
195.82.146.52
93.114.40.103

7397
ipset/zapret-ip.txt Normal file

File diff suppressed because it is too large Load Diff