mirror of
https://github.com/bol-van/zapret.git
synced 2026-02-03 00:00:34 +03:00
ipset: use awk instead of grep to avoid wrong ip matches
This commit is contained in:
@@ -10,6 +10,12 @@ ZREESTR="$TMPDIR/reestr.txt"
|
||||
ZURL_REESTR=https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv
|
||||
|
||||
|
||||
awkgrep()
|
||||
{
|
||||
# $1 - pattern
|
||||
nice -n 5 $AWK "{while ( match(\$0,/($1[ |;])/) ) { print substr(\$0,RSTART,RLENGTH-1); \$0=substr(\$0,RSTART+RLENGTH) } }"
|
||||
}
|
||||
|
||||
dig_reestr()
|
||||
{
|
||||
# $1 - grep ipmask
|
||||
@@ -18,10 +24,9 @@ dig_reestr()
|
||||
|
||||
echo processing reestr list $2
|
||||
|
||||
tail -n +2 "$ZREESTR" | nice -n 5 $GREP -oE "$1" | cut_local | ip2net$3 | zz "$2"
|
||||
tail -n +2 "$ZREESTR" | awkgrep "$1" | cut_local | ip2net$3 | zz "$2"
|
||||
}
|
||||
|
||||
|
||||
getuser && {
|
||||
# assume all https banned by ip
|
||||
curl -k --fail --max-time 600 --connect-timeout 5 --retry 3 --max-filesize 251658240 "$ZURL_REESTR" -o "$ZREESTR" ||
|
||||
|
||||
Reference in New Issue
Block a user