diff --git a/compile/build_howto_openwrt.txt b/compile/build_howto_openwrt.txt index c334587..eaf738c 100644 --- a/compile/build_howto_openwrt.txt +++ b/compile/build_howto_openwrt.txt @@ -36,6 +36,7 @@ How to compile native programs for use in openwrt 6) make package/tpws/compile make package/nfqws/compile make package/ip2net/compile + make package/mdig/compile 7) find bin -name tpws*.ipk #take your tpws*.ipk , nfqws*.ipk , ip2net*.ipk from there diff --git a/ipset/def.sh b/ipset/def.sh index 7b435a7..e016d7c 100755 --- a/ipset/def.sh +++ b/ipset/def.sh @@ -11,15 +11,26 @@ ZIPLIST_IPBAN=$EXEDIR/zapret-ip-ipban.txt ZIPLIST_USER_IPBAN=$EXEDIR/zapret-ip-user-ipban.txt ZUSERLIST_IPBAN=$EXEDIR/zapret-hosts-user-ipban.txt +MDIG=$EXEDIR/../mdig/mdig +MDIG_THREADS=30 + +digger() +{ + if [ -x $MDIG ]; then + $MDIG --family=4 --threads=$MDIG_THREADS <$1 + else + dig A +short +time=8 +tries=2 -f $1 + fi +} getuser() { - [ -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 -u >$ZIPLIST_USER - } - [ -f $ZUSERLIST_IPBAN ] && { - dig A +short +time=8 +tries=2 -f $ZUSERLIST_IPBAN | 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 -u >$ZIPLIST_USER_IPBAN - } + for f in $ZUSERLIST $ZUSERLIST_IPBAN + do + [ -f $f ] && { + digger $f | 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 -u >$ZIPLIST_USER + } + done } cut_local() diff --git a/ipset/get_reestr.sh b/ipset/get_reestr.sh index 9c9cc1b..74b8a73 100755 --- a/ipset/get_reestr.sh +++ b/ipset/get_reestr.sh @@ -12,18 +12,6 @@ ZIPLISTTMP=$TMPDIR/zapret-ip.txt #ZURL=https://reestr.rublacklist.net/api/current ZURL=https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv -MDIG=$EXEDIR/../mdig/mdig -MDIG_THREADS=30 - -digger() -{ - if [ -x $MDIG ]; then - $MDIG --family=4 --threads=$MDIG_THREADS <$1 - else - dig A +short +time=8 +tries=2 -f $1 - fi -} - getuser curl -k --fail --max-time 300 --max-filesize 41943040 "$ZURL" >$ZREESTR ||