ipset: scripts maintenance

This commit is contained in:
bol-van 2024-12-22 13:38:36 +03:00
parent 8aabc8b743
commit 42c52014ee
9 changed files with 13 additions and 13 deletions

View File

@ -7,7 +7,7 @@ get_antifilter()
[ "$DISABLE_IPV4" != "1" ] && { [ "$DISABLE_IPV4" != "1" ] && {
curl --fail --max-time 150 --connect-timeout 20 --max-filesize 41943040 -k -L "$1" | cut_local >"$ZIPLISTTMP" && 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 if [ $dlsize -lt 102400 ]; then
echo list file is too small. can be bad. echo list file is too small. can be bad.
exit 2 exit 2

View File

@ -21,7 +21,7 @@ curl -H "Accept-Encoding: gzip" -k --fail --max-time 600 --connect-timeout 5 --r
exit 2 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 if test $dlsize -lt 102400; then
echo list file is too small. can be bad. echo list file is too small. can be bad.
exit 2 exit 2

View File

@ -21,7 +21,7 @@ dl_checked()
echo list download failed : $1 echo list download failed : $1
return 2 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 if test $dlsize -lt $3; then
echo list is too small : $dlsize bytes. can be bad. echo list is too small : $dlsize bytes. can be bad.
return 2 return 2
@ -31,11 +31,11 @@ dl_checked()
reestr_list() 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() 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() ipban_fin()

View File

@ -24,7 +24,7 @@ dl()
echo list download failed : $1 echo list download failed : $1
exit 2 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 if test $dlsize -lt $3; then
echo list is too small : $dlsize bytes. can be bad. echo list is too small : $dlsize bytes. can be bad.
exit 2 exit 2

View File

@ -24,7 +24,7 @@ dl()
echo list download failed : $1 echo list download failed : $1
exit 2 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 if test $dlsize -lt $3; then
echo list is too small : $dlsize bytes. can be bad. echo list is too small : $dlsize bytes. can be bad.
exit 2 exit 2

View File

@ -23,7 +23,7 @@ dl()
echo list download failed : $1 echo list download failed : $1
exit 2 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 if test $dlsize -lt $3; then
echo list is too small : $dlsize bytes. can be bad. echo list is too small : $dlsize bytes. can be bad.
exit 2 exit 2

View File

@ -24,7 +24,7 @@ dl_checked()
echo list download failed : $1 echo list download failed : $1
return 2 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 if test $dlsize -lt $3; then
echo list is too small : $dlsize bytes. can be bad. echo list is too small : $dlsize bytes. can be bad.
return 2 return 2
@ -34,11 +34,11 @@ dl_checked()
reestr_list() 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() 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 && { getuser && {

View File

@ -20,7 +20,7 @@ dl()
echo list download failed : $1 echo list download failed : $1
exit 2 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 if test $dlsize -lt $3; then
echo list is too small : $dlsize bytes. can be bad. echo list is too small : $dlsize bytes. can be bad.
exit 2 exit 2

View File

@ -20,7 +20,7 @@ dl()
echo list download failed : $1 echo list download failed : $1
exit 2 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 if test $dlsize -lt $3; then
echo list is too small : $dlsize bytes. can be bad. echo list is too small : $dlsize bytes. can be bad.
exit 2 exit 2