From 42c52014ee1c7fb3d0ae0c39c2f95df32fbe322a Mon Sep 17 00:00:00 2001 From: bol-van Date: Sun, 22 Dec 2024 13:38:36 +0300 Subject: [PATCH] ipset: scripts maintenance --- ipset/antifilter.helper | 2 +- ipset/get_antizapret_domains.sh | 2 +- ipset/get_reestr_hostlist.sh | 6 +++--- ipset/get_reestr_preresolved.sh | 2 +- ipset/get_reestr_preresolved_smart.sh | 2 +- ipset/get_reestr_resolvable_domains.sh | 2 +- ipset/get_reestr_resolve.sh | 6 +++--- ipset/get_refilter_domains.sh | 2 +- ipset/get_refilter_ipsum.sh | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ipset/antifilter.helper b/ipset/antifilter.helper index 0508209..16b2903 100644 --- a/ipset/antifilter.helper +++ b/ipset/antifilter.helper @@ -7,7 +7,7 @@ get_antifilter() [ "$DISABLE_IPV4" != "1" ] && { curl --fail --max-time 150 --connect-timeout 20 --max-filesize 41943040 -k -L "$1" | cut_local >"$ZIPLISTTMP" && { - dlsize=$(LANG=C wc -c "$ZIPLISTTMP" | xargs | cut -f 1 -d ' ') + dlsize=$(LC_ALL=C LANG=C wc -c "$ZIPLISTTMP" | xargs | cut -f 1 -d ' ') if [ $dlsize -lt 102400 ]; then echo list file is too small. can be bad. exit 2 diff --git a/ipset/get_antizapret_domains.sh b/ipset/get_antizapret_domains.sh index 1561257..1bbbdc4 100755 --- a/ipset/get_antizapret_domains.sh +++ b/ipset/get_antizapret_domains.sh @@ -21,7 +21,7 @@ curl -H "Accept-Encoding: gzip" -k --fail --max-time 600 --connect-timeout 5 --r exit 2 } -dlsize=$(LANG=C wc -c "$ZDOM" | xargs | cut -f 1 -d ' ') +dlsize=$(LC_ALL=C LANG=C wc -c "$ZDOM" | xargs | cut -f 1 -d ' ') if test $dlsize -lt 102400; then echo list file is too small. can be bad. exit 2 diff --git a/ipset/get_reestr_hostlist.sh b/ipset/get_reestr_hostlist.sh index afa5d9b..9c3ee95 100755 --- a/ipset/get_reestr_hostlist.sh +++ b/ipset/get_reestr_hostlist.sh @@ -21,7 +21,7 @@ dl_checked() echo list download failed : $1 return 2 } - dlsize=$(LANG=C wc -c "$2" | xargs | cut -f 1 -d ' ') + dlsize=$(LC_ALL=C LANG=C wc -c "$2" | xargs | cut -f 1 -d ' ') if test $dlsize -lt $3; then echo list is too small : $dlsize bytes. can be bad. return 2 @@ -31,11 +31,11 @@ dl_checked() reestr_list() { - LANG=C gunzip -c "$ZREESTR" | cut -s -f2 -d';' | LANG=C nice -n 5 sed -Ee 's/^\*\.(.+)$/\1/' -ne 's/^[a-z0-9A-Z._-]+$/&/p' | $AWK '{ print tolower($0) }' + LC_ALL=C LANG=C gunzip -c "$ZREESTR" | cut -s -f2 -d';' | LC_ALL=C LANG=C nice -n 5 sed -Ee 's/^\*\.(.+)$/\1/' -ne 's/^[a-z0-9A-Z._-]+$/&/p' | $AWK '{ print tolower($0) }' } reestr_extract_ip() { - LANG=C gunzip -c | nice -n 5 $AWK -F ';' '($1 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}/) && (($2 == "" && $3 == "") || ($1 == $2)) {gsub(/ \| /, RS); print $1}' | LANG=C $AWK '{split($1, a, /\|/); for (i in a) {print a[i]}}' + LC_ALL=C LANG=C gunzip -c | nice -n 5 $AWK -F ';' '($1 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}/) && (($2 == "" && $3 == "") || ($1 == $2)) {gsub(/ \| /, RS); print $1}' | LC_ALL=C LANG=C $AWK '{split($1, a, /\|/); for (i in a) {print a[i]}}' } ipban_fin() diff --git a/ipset/get_reestr_preresolved.sh b/ipset/get_reestr_preresolved.sh index 4bdee95..e6ff585 100755 --- a/ipset/get_reestr_preresolved.sh +++ b/ipset/get_reestr_preresolved.sh @@ -24,7 +24,7 @@ dl() echo list download failed : $1 exit 2 } - dlsize=$(LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') + dlsize=$(LC_ALL=C LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') if test $dlsize -lt $3; then echo list is too small : $dlsize bytes. can be bad. exit 2 diff --git a/ipset/get_reestr_preresolved_smart.sh b/ipset/get_reestr_preresolved_smart.sh index 3507bb9..0310556 100755 --- a/ipset/get_reestr_preresolved_smart.sh +++ b/ipset/get_reestr_preresolved_smart.sh @@ -24,7 +24,7 @@ dl() echo list download failed : $1 exit 2 } - dlsize=$(LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') + dlsize=$(LC_ALL=C LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') if test $dlsize -lt $3; then echo list is too small : $dlsize bytes. can be bad. exit 2 diff --git a/ipset/get_reestr_resolvable_domains.sh b/ipset/get_reestr_resolvable_domains.sh index 2821446..6785916 100755 --- a/ipset/get_reestr_resolvable_domains.sh +++ b/ipset/get_reestr_resolvable_domains.sh @@ -23,7 +23,7 @@ dl() echo list download failed : $1 exit 2 } - dlsize=$(LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') + dlsize=$(LC_ALL=C LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') if test $dlsize -lt $3; then echo list is too small : $dlsize bytes. can be bad. exit 2 diff --git a/ipset/get_reestr_resolve.sh b/ipset/get_reestr_resolve.sh index 41adb72..c94e15f 100755 --- a/ipset/get_reestr_resolve.sh +++ b/ipset/get_reestr_resolve.sh @@ -24,7 +24,7 @@ dl_checked() echo list download failed : $1 return 2 } - dlsize=$(LANG=C wc -c "$2" | xargs | cut -f 1 -d ' ') + dlsize=$(LC_ALL=C LANG=C wc -c "$2" | xargs | cut -f 1 -d ' ') if test $dlsize -lt $3; then echo list is too small : $dlsize bytes. can be bad. return 2 @@ -34,11 +34,11 @@ dl_checked() reestr_list() { - LANG=C gunzip -c "$ZREESTR" | cut -s -f2 -d';' | LANG=C nice -n 5 sed -Ee 's/^\*\.(.+)$/\1/' -ne 's/^[a-z0-9A-Z._-]+$/&/p' | $AWK '{ print tolower($0) }' + LC_ALL=C LANG=C gunzip -c "$ZREESTR" | cut -s -f2 -d';' | LC_ALL=C LANG=C nice -n 5 sed -Ee 's/^\*\.(.+)$/\1/' -ne 's/^[a-z0-9A-Z._-]+$/&/p' | $AWK '{ print tolower($0) }' } reestr_extract_ip() { - LANG=C gunzip -c | nice -n 5 $AWK -F ';' '($1 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}/) && (($2 == "" && $3 == "") || ($1 == $2)) {gsub(/ \| /, RS); print $1}' | LANG=C $AWK '{split($1, a, /\|/); for (i in a) {print a[i]}}' + LC_ALL=C LANG=C gunzip -c | nice -n 5 $AWK -F ';' '($1 ~ /^([0-9]{1,3}\.){3}[0-9]{1,3}/) && (($2 == "" && $3 == "") || ($1 == $2)) {gsub(/ \| /, RS); print $1}' | LC_ALL=C LANG=C $AWK '{split($1, a, /\|/); for (i in a) {print a[i]}}' } getuser && { diff --git a/ipset/get_refilter_domains.sh b/ipset/get_refilter_domains.sh index c61c867..f329ad6 100755 --- a/ipset/get_refilter_domains.sh +++ b/ipset/get_refilter_domains.sh @@ -20,7 +20,7 @@ dl() echo list download failed : $1 exit 2 } - dlsize=$(LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') + dlsize=$(LC_ALL=C LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') if test $dlsize -lt $3; then echo list is too small : $dlsize bytes. can be bad. exit 2 diff --git a/ipset/get_refilter_ipsum.sh b/ipset/get_refilter_ipsum.sh index 5f15ed0..58c646f 100755 --- a/ipset/get_refilter_ipsum.sh +++ b/ipset/get_refilter_ipsum.sh @@ -20,7 +20,7 @@ dl() echo list download failed : $1 exit 2 } - dlsize=$(LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') + dlsize=$(LC_ALL=C LANG=C wc -c "$TMPLIST" | xargs | cut -f 1 -d ' ') if test $dlsize -lt $3; then echo list is too small : $dlsize bytes. can be bad. exit 2