mdig : multithread digger

This commit is contained in:
bolvan
2019-04-17 14:12:14 +03:00
parent 7b15029279
commit 0d58f6171e
13 changed files with 315 additions and 4 deletions

View File

@@ -12,6 +12,18 @@ 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 ||
@@ -30,12 +42,12 @@ echo preparing dig list ..
cut -f2 -d';' $ZREESTR | grep -avE '^$|\*|:' >$ZDIG
rm -f $ZREESTR
echo digging started ...
dig A +short +time=8 +tries=2 -f $ZDIG | 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]+$' >$ZIPLISTTMP || {
digger $ZDIG | 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]+$' >$ZIPLISTTMP || {
rm -f $ZDIG
exit 1
}
rm -f $ZDIG $ZIPLIST
sort $ZIPLISTTMP | uniq >$ZIPLIST
sort -u $ZIPLISTTMP >$ZIPLIST
rm -f $ZIPLISTTMP
"$EXEDIR/create_ipset.sh"