Skip to content

Instantly share code, notes, and snippets.



Last active Dec 13, 2020
What would you like to do?
Convert the RKN list to a Mikrotik firewall address list
Download the RKN list from, massage it into
a Mikrotik script that manages a firewall address list, and put it up on a web
server. Note well that the list is gigantic---more than 80,000 entries as of
2018-04-28---so be sure to check if your router can handle it in advance (for
example, hAP Lite, with its measly 32M of memory, can’t).
On the router side, do something like
/tool fetch url="" dst-path=rkn.rsc
:import rkn.src
(although executing some guy’s scripts on your router is silly, you really
should host your own).
#!/bin/bash -e
set -o pipefail
curl -sS '' \
| iconv -f cp1251 \
| sed -re 's/^([^;]*);.*$/\1/' -e 's/ \| /\n/g' \
| sort -u \
| { echo '/ip firewall address-list';
echo 'remove numbers=[find list=rkn]';
sed -rne 's/^([0-9]+\.){3}[0-9]+(\/[0-9]+)?$/add list=rkn address=&/p'; } \
mv /tmp/rkn.rsc rkn.rsc
Description=Update RKN list
Description=Update RKN list daily
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment