#!/bin/bash
#clear address-list before add
echo "/ip fire addr remove [/ip fir addr find list=facebook]" > facebook.rsc
whois -h whois.radb.net -- '-i origin AS32934' | awk '/^route:/ {print "/ip fire addr add list=facebook address=" $2;}' | sort | uniq >> facebook.rsc
#comment out next 3 lines if you dont use ipv6
echo "/ipv6 fire addr remove [/ipv6 fir addr find list=facebook]" >> facebook.rsc
whois -h whois.radb.net -- '-i origin AS32934' | awk '/^route6:/ {print "/ipv6 fire addr add list=facebook address=" $2;}' | sort | uniq >> facebook.rsc
echo "/ipv6 fire fil add chain=forward dst-address-list=facebook action=reject" >> facebook.rsc

echo "/ip fire fil add chain=forward dst-address-list=facebook action=reject" >> facebook.rsc
