User Tools

Site Tools


networking:router:mikrotik_manual_blacklist

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking:router:mikrotik_manual_blacklist [2024/04/04 09:34]
gcooper
networking:router:mikrotik_manual_blacklist [2025/02/25 16:10] (current)
gcooper
Line 61: Line 61:
  
 ====== Script ====== ====== Script ======
 +
 +FIXME Super slow and may not be 100% correct for ROS v7.
  
 :!: You should first run this script at the ROS command line to look for errors. :!: You should first run this script at the ROS command line to look for errors.
Line 77: Line 79:
     \n##\r\     \n##\r\
     \n:put \"\";\r\     \n:put \"\";\r\
-    \n:put \"This script requires the address text file to have UNIX line endi\ +    \n:put \"This script requires the address text file to have UNIX line endings.\";\r\
-    ngs.\";\r\+
     \n\     \n\
     \n:put \"\";\r\     \n:put \"\";\r\
Line 90: Line 91:
     \n:put \"\";\r\     \n:put \"\";\r\
     \n##:put \"Removing all old address-list entries...\";\r\     \n##:put \"Removing all old address-list entries...\";\r\
-    \n##/ip firewall address-list remove [/ip firewall address-list find list=+    \n##/ip firewall address-list remove [/ip firewall address-list find list=blacklist];\r\
-    blacklist];\r\+
     \n:global content [/file get [/file find name=ipaddress.txt] contents] ;\r\     \n:global content [/file get [/file find name=ipaddress.txt] contents] ;\r\
     \n:global contentLen [ :len \$content ] ;\r\     \n:global contentLen [ :len \$content ] ;\r\
Line 101: Line 101:
     \n      :set line [:pick \$content \$lastEnd \$lineEnd] ;\r\     \n      :set line [:pick \$content \$lastEnd \$lineEnd] ;\r\
     \n      :set lastEnd ( \$lineEnd + 1 ) ;\r\     \n      :set lastEnd ( \$lineEnd + 1 ) ;\r\
-    \n      #If the line doesn't start with a hash then process and add to the+    \n      #If the line doesn't start with a hash then process and add to the list\r\
-    \_list\r\+
     \n      :if ( [:pick \$line 0 1] != \"#\" ) do={\r\     \n      :if ( [:pick \$line 0 1] != \"#\" ) do={\r\
     \n      :local entry [:pick \$line 0 \$lineEnd ]\r\     \n      :local entry [:pick \$line 0 \$lineEnd ]\r\
     \n      :if ( [:len \$entry ] > 0 ) do={\r\     \n      :if ( [:len \$entry ] > 0 ) do={\r\
     \n         :put \"Removing \$entry from blacklist, if it exists\";\r\     \n         :put \"Removing \$entry from blacklist, if it exists\";\r\
-    \n         /ip firewall address-list remove [find list=\"blacklist\" addre\ +    \n         /ip firewall address-list remove [find list=\"blacklist\" address=\$entry];\r\
-    ss=\$entry];\r\+
     \n         :put \"Address being added is \$entry\";\r\     \n         :put \"Address being added is \$entry\";\r\
-    \n         /ip firewall address-list add list=blacklist address=\$entry co\ +    \n         /ip firewall address-list add list=blacklist address=\$entry comment=\"Spammer\";\r\
-    mment=\"Spammer\";\r\+
     \n         }\r\     \n         }\r\
     \n      }\r\     \n      }\r\
networking/router/mikrotik_manual_blacklist.1712244893.txt.gz · Last modified: 2024/04/04 09:34 by gcooper