add mdig support to get_user.sh

This commit is contained in:
bolvan 2019-04-17 16:19:00 +03:00
parent d66326410f
commit b2ef5efa0a
3 changed files with 18 additions and 18 deletions

View File

@ -36,6 +36,7 @@ How to compile native programs for use in openwrt
6) make package/tpws/compile 6) make package/tpws/compile
make package/nfqws/compile make package/nfqws/compile
make package/ip2net/compile make package/ip2net/compile
make package/mdig/compile
7) find bin -name tpws*.ipk 7) find bin -name tpws*.ipk
#take your tpws*.ipk , nfqws*.ipk , ip2net*.ipk from there #take your tpws*.ipk , nfqws*.ipk , ip2net*.ipk from there

View File

@ -11,15 +11,26 @@ ZIPLIST_IPBAN=$EXEDIR/zapret-ip-ipban.txt
ZIPLIST_USER_IPBAN=$EXEDIR/zapret-ip-user-ipban.txt ZIPLIST_USER_IPBAN=$EXEDIR/zapret-ip-user-ipban.txt
ZUSERLIST_IPBAN=$EXEDIR/zapret-hosts-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() getuser()
{ {
[ -f $ZUSERLIST ] && { for f in $ZUSERLIST $ZUSERLIST_IPBAN
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 do
} [ -f $f ] && {
[ -f $ZUSERLIST_IPBAN ] && { 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
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 }
} done
} }
cut_local() cut_local()

View File

@ -12,18 +12,6 @@ ZIPLISTTMP=$TMPDIR/zapret-ip.txt
#ZURL=https://reestr.rublacklist.net/api/current #ZURL=https://reestr.rublacklist.net/api/current
ZURL=https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv 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 getuser
curl -k --fail --max-time 300 --max-filesize 41943040 "$ZURL" >$ZREESTR || curl -k --fail --max-time 300 --max-filesize 41943040 "$ZURL" >$ZREESTR ||