Загрузка Tor-статистики в списки ipset
#!/bin/bash # This script updates ipset lists in memory and in file ipset_DB.txt CONSENSUS=/var/lib/tor/cached-microdesc-consensus MAXELEM=16384 ipset flush echo Number of entries: ipset n GuardORPort hash:ip,port maxelem $MAXELEM -! cat $CONSENSUS \ |egrep '^r |^s ' |grep -B 1 '^s .*Guard' |grep '^r ' |cut -d' ' -f6-7 \ |sed 's/ /,tcp:/;s/^\(.*\)$/add GuardORPort \1 -!/' \ |ipset restore -! echo " "GuardORPort: $(ipset list GuardORPort |sed '1,7d' |wc -l) ipset n GuardDirPort hash:ip,port maxelem $MAXELEM -! cat $CONSENSUS \ |egrep '^r |^s ' |grep -B 1 '^s .*Guard' |grep '^r ' |cut -d' ' -f6,8 \ |sed 's/ /,tcp:/;/.*:0$/d;s/^\(.*\)$/add GuardDirPort \1 -!/' \ |ipset restore -! echo " "GuardDirPort: $(ipset list GuardDirPort |sed '1,7d' |wc -l) ipset n NonGuardORPort hash:ip,port maxelem $MAXELEM -! grep -F -x -v -f \ <(cat $CONSENSUS \ |egrep '^r |^s ' |grep -B 1 '^s .*Guard' |grep '^r ' \ |cut -d' ' -f6-7 |sed 's/ /,tcp:/' |sort) \ <(cat $CONSENSUS |egrep '^r ' \ |cut -d' ' -f6-7 |sed 's/ /,tcp:/' |sort) \ |sed 's/^\(.*\)$/add NonGuardORPort \1 -!/' \ |ipset restore -! echo " "NonGuardORPort: $(ipset list NonGuardORPort |sed '1,7d' |wc -l) ipset n NonGuardDirPort hash:ip,port maxelem $MAXELEM -! grep -F -x -v -f \ <(cat $CONSENSUS \ |egrep '^r |^s ' |grep -B 1 '^s .*Guard' |grep '^r ' \ |cut -d' ' -f6,8 |sed 's/ /,tcp:/;/.*:0$/d' |sort) \ <(cat $CONSENSUS |egrep '^r ' \ |cut -d' ' -f6,8 |sed 's/ /,tcp:/;/.*:0$/d' |sort) \ |sed 's/^\(.*\)$/add NonGuardDirPort \1 -!/' \ |ipset restore -! echo " "NonGuardDirPort: $(ipset list NonGuardDirPort |sed '1,7d' |wc -l) ipset save -file ipset_DB.txt
Комментариев нет [показать комментарии/форму]
Ваша оценка документа [показать результаты]