mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-23 06:42:34 +00:00
support for zapret-ip-exclude.txt
This commit is contained in:
parent
b8ad407912
commit
918a088527
@ -6,25 +6,18 @@ EXEDIR=$(dirname $SCRIPT)
|
|||||||
|
|
||||||
. "$EXEDIR/def.sh"
|
. "$EXEDIR/def.sh"
|
||||||
|
|
||||||
|
|
||||||
create_ipset()
|
create_ipset()
|
||||||
{
|
{
|
||||||
ipset flush $1 2>/dev/null || ipset create $1 hash:ip
|
ipset flush $1 2>/dev/null || ipset create $1 hash:ip
|
||||||
|
|
||||||
local TEMPIPSET=/tmp/ipset.$1.tmp
|
|
||||||
|
|
||||||
for f in "$2" "$3"
|
for f in "$2" "$3"
|
||||||
do
|
do
|
||||||
[ -f $TEMPIPSET ] && rm -f $TEMPIPSET
|
|
||||||
[ -f "$f" ] && {
|
[ -f "$f" ] && {
|
||||||
echo Adding to ipset "$1" : $f
|
echo Adding to ipset $1 : $f
|
||||||
touch $TEMPIPSET
|
if [ -f "$ZIPLIST_EXCLUDE" ] ; then
|
||||||
sort $f | uniq | while read ip;
|
grep -vxf $ZIPLIST_EXCLUDE "$f" | sort -u | while read ip; do echo add $1 $ip; done | ipset -! restore
|
||||||
do
|
else
|
||||||
echo add $1 $ip >>$TEMPIPSET
|
sort -u "$f" | while read ip; do echo add $1 $ip; done | ipset -! restore
|
||||||
done
|
fi
|
||||||
ipset -! restore <$TEMPIPSET 2>&1
|
|
||||||
rm -f $TEMPIPSET
|
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
ZIPSET=zapret
|
ZIPSET=zapret
|
||||||
ZIPLIST=$EXEDIR/zapret-ip.txt
|
ZIPLIST=$EXEDIR/zapret-ip.txt
|
||||||
|
ZIPLIST_EXCLUDE=$EXEDIR/zapret-ip-exclude.txt
|
||||||
ZIPLIST_USER=$EXEDIR/zapret-ip-user.txt
|
ZIPLIST_USER=$EXEDIR/zapret-ip-user.txt
|
||||||
ZUSERLIST=$EXEDIR/zapret-hosts-user.txt
|
ZUSERLIST=$EXEDIR/zapret-hosts-user.txt
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user