initial
This commit is contained in:
parent
e517d86887
commit
22f6291fd2
1 changed files with 41 additions and 0 deletions
41
get-ip.sh
Normal file
41
get-ip.sh
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
# Скрипт для скачивания IPv4 адресов и добавления их в bird
|
||||
# Основан на https://habr.com/ru/articles/359268/
|
||||
# Доработал AlexandrLinux (собака) bafista.ru
|
||||
# Основной список адресов взят тут: https://github.com/lord-alfred/ipranges/tree/main?tab=readme-ov-file
|
||||
workdir=/opt/get-ip
|
||||
cd $workdir/list
|
||||
wget -N -O RU.lst https://github.com/ipverse/rir-ip/raw/refs/heads/master/country/ru/ipv4-aggregated.txt
|
||||
#wget -N https://antifilter.download/list/ipsum.lst
|
||||
#wget -N https://antifilter.download/list/subnet.lst
|
||||
wget -N -O ip.lst https://antifilter.network/download/ip.lst
|
||||
wget -N -O Meta.lst https://raw.githubusercontent.com/SecOps-Institute/FacebookIPLists/master/facebook_ip_list.lst
|
||||
wget -N -O Google.lst https://raw.githubusercontent.com/lord-alfred/ipranges/main/google/ipv4.txt
|
||||
wget -N -O Microsoft.lst https://raw.githubusercontent.com/lord-alfred/ipranges/main/microsoft/ipv4.txt
|
||||
wget -N -O Telegram.lst https://github.com/lord-alfred/ipranges/raw/refs/heads/main/telegram/ipv4.txt
|
||||
wget -N -O Facebook.lst https://github.com/lord-alfred/ipranges/raw/refs/heads/main/facebook/ipv4.txt
|
||||
old=$(cat $workdir/md5.txt);
|
||||
new=$(cat $workdir/list/*.lst | md5sum | head -c 32);
|
||||
if [ "$old" != "$new" ]
|
||||
then
|
||||
echo "md5 chandge"
|
||||
#cat $workdir/list/ipsum.lst | sed 's_.*_route & reject;_' > /etc/bird/ipsum.txt
|
||||
#cat $workdir/list/subnet.lst | sed 's_.*_route & reject;_' > /etc/bird/subnet.txt
|
||||
echo "Configure bird start"
|
||||
sed -i '/^#/d' $workdir/list/RU.lst && cat $workdir/list/RU.lst | sed 's_.*_route & reject;_' > /etc/bird/RU.txt
|
||||
cat $workdir/list/ip.lst | sed 's_.*_route & reject;_' > /etc/bird/ip.txt
|
||||
cat $workdir/list/Meta.lst | sed 's_.*_route & reject;_' > /etc/bird/Meta.txt
|
||||
cat $workdir/list/Google.lst | sed 's_.*_route & reject;_' > /etc/bird/Google.txt
|
||||
cat $workdir/list/Microsoft.lst | sed 's_.*_route & reject;_' > /etc/bird/Microsoft.txt
|
||||
cat $workdir/list/Telegram.lst | sed 's_.*_route & reject;_' > /etc/bird/Telegram.txt
|
||||
cat $workdir/list/Facebook.lst | sed 's_.*_route & reject;_' > /etc/bird/Facebook.txt
|
||||
/usr/sbin/birdc configure;
|
||||
logger "BGP list reconfigured";
|
||||
echo "Configure bird done"
|
||||
echo $new > $workdir/md5.txt;
|
||||
echo "New md5 write"
|
||||
exit 0
|
||||
fi
|
||||
echo "MD5 not change"
|
||||
echo "Bird not reconfigure"
|
||||
exit 0
|
||||
Loading…
Reference in a new issue