Browse Source

add mdig support to get_user.sh

pull/31/head
bolvan 6 years ago
parent
commit
b2ef5efa0a
  1. 1
      compile/build_howto_openwrt.txt
  2. 23
      ipset/def.sh
  3. 12
      ipset/get_reestr.sh

1
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

23
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()

12
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 ||

Loading…
Cancel
Save