Create an address list from a text file

Hi Guys,

Does anyone know how I can easily create an address list from a text file?

A few suggestions were made in another thread, but I have started a new thread as this is another more specific question.

I would like a simple way of importing these addresses into an address list on the router to be used in my firewall with a drop rule.
http://www.spamhaus.org/drop/drop.txt

Thanks guys.

I think that if you love to do scripts, this could be a really interesting first ROS script.

Use search function before ask.

Already I’ve write one script for example on another topic,

BUT YOU CAN NOT IMPORT THAT FILE, IS BIGGER THAN 4096 BYTE!!!



This import edrop, the other file, but you can modify the parameters of that script (line to skip and filename), and you need to split manually drop.txt in more than 5 files, not bigger than 4096 BYTE eachone, each file must be end correctly with one complete line.

:local content value=[/file get [/file find name="edrop.txt"] contents];
:local contentLen value=[:len $content];
:local lineEnd value=0;
:local line value="";
:local lastEnd value=0;
:local lineToSkip value=4;
:local lineSkipped value=0;
:local ipInterval value="";
:local sblCode value="";

:do {
 :set $lineEnd value=[:find $content "\n" $lastEnd];
 :set $line value=[:pick $content $lastEnd $lineEnd];
 :set $lastEnd value=($lineEnd + 1);
 :if ($lineSkipped < $lineToSkip) do={
  :set $lineSkipped value=($lineSkipped + 1);
 } else={
  :if ( $line != "" ) do={
   :set $ipInterval value=[:pick $line 0 [:find $line " ; " -1] ];
   :set $sblCode value=[:pick $line ([:find $line " ; " -1] +3) [:len $line ] ];
   /ip firewall address-list add address=$ipInterval comment=$sblCode list="AAA_ip_DROP";
  }
 }
} while=($lineEnd < $contentLen);

And if anyone use my script, please add Karma, thanks.

While I realize that this is an old thread, I just wanted to let folks know that I recently came across this..

http://joshaven.com/resources/tricks/mikrotik-automatically-updated-address-list/

:slight_smile:

how is this ? its simply add the adresses to addres list and what did you do with them ? you block all ? how is working ?