Langsung saja buat file terserah, jangan lupa install
apt-get -q -y install libnet-netmask-perlkemudian buat file misalnya coba.sh
echo -n "as numbernya contoh AS55666 = "kalau ingin multi AS Number bisa gunakan script berikut ini
read asnum
whois -h whois.radb.net -- -i origin $asnum| grep '^route:' | perl -MNet::Netmask -ne'm!(\d+\.\d+\.\d+\.\d+/?\d*)! or next; $h = $1; $h =~ s/(\.0)+$//; $b=Net::Netmask->new($h); $b->storeNetblock(); END {print map {$_->base()."/".$_->bits()."\n"} cidrs2cidrs(dumpNetworkTable)}' | awk '{print "/ip firewall address-list add list=cidr_tertentu address=" $1}';
rm -rfv IP ASN dump.rsc;
echo "AS58816 GARENAINDO
" > ASN
echo > IP
echo -e '/ip firewall address-list\n add list=cidr_dump address=0.0.0.1\n rem [find list="cidr_dump"]' > dump.rsc ;
#apt-get -q -y install libnet-netmask-perl
clear
d=$(date +%H)
if [ $d -lt 12 ]
then
echo -e " Met pagi Om,"
elif [ $d -lt 16 ]
then
echo -e " Met siang om,"
elif [ $d -lt 20 ]
then
echo -e " Sore om,"
else
echo -e " Malem om,"
fi
echo -e ' Ini daftar AS Number yang akan di-dump :\n\n' ;
cat ASN;
echo -e ' Silahkan Tunggu...\n\n' ;
tail -f IP &
for ASN in $(cat ASN | awk '{print $1}');
do
{ whois -h whois.radb.net -- "-i origin $ASN" | grep '^route:' | perl -MNet::Netmask -ne'm!(\d+\.\d+\.\d+\.\d+/?\d*)! or next; $h = $1; $h =~ s/(\.0)+$//; $b=Net::Netmask->new($h); $b->storeNetblock(); END {print map {$_->base()."/".$_->bits()."\n"} cidrs2cidrs(dumpNetworkTable)}'; } >> IP
sleep 5
done
cat IP | awk '{print "add list=cidr_dump address=" $1}' >> dump.rsc
echo -e '### ====== EOF ====== ###' >> dump.rsc
sed -i '4d' dump.rsc
cat dump.rsc
0 comments:
Post a Comment