Advertisement
Guest User

mikrotik_rkn

a guest
May 23rd, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #!/bin/bash
  2. rm -f dump.csv
  3. wget -q https://raw.githubusercontent.com/zapret-info/z-i/master/dump.csv || exit 1
  4.  
  5. cat dump.csv | cut -d";" -f1 | tr '|' '\n' | grep '/' | tr -d ' ' | sort -k1 -n | uniq > norkn_subnets.txt
  6. cat dump.csv | cut -d";" -f1 | tr '|' '\n' | grep -v '/' | tr -d ' ' | sort -k1 -n | uniq | egrep -v "Updated|^$" > norkn_hosts.txt
  7. cat norkn_hosts.txt | sed 's/\./ /g' | awk '{ print $1"."$2"."$3 }' | sort | uniq -d | awk '{ print $1".0/24" }' > norkn_hosts_uniq_net_24.txt
  8. cp norkn_hosts_uniq_net_24.txt norkn_subnets_and_uniq_net_24.txt
  9. grep -v --fixed-strings ".0/24"./norkn_subnets.txt >> norkn_subnets_and_uniq_net_24.txt
  10.  
  11. echo "/ip firewall address-list remove numbers=[ find list=rkn_block ]" > norkn_subnets_and_uniq_net_24.rsc
  12. cat norkn_subnets_and_uniq_net_24.txt | awk '{ print "/ip firewall address-list add address="$1" list=rkn_block timeout=30d12h" }' >> norkn_subnets_and_uniq_net_24.rsc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement