Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 21217

Scripting • Re: Script error: already have such entry (address lists)

$
0
0
full of useless...
Code:
/ip firewall address-list remove [/ip firewall address-list find list=firehol_L1]/ip firewall address-list add addres=1.10.16.0/20 list=firehol_L1 timeout=2d/ip firewall address-list add addres=1.19.0.0/16 list=firehol_L1 timeout=2d/ip firewall address-list add addres=1.32.128.0/18 list=firehol_L1 timeout=2d/ip firewall address-list add addres=2.56.192.0/22 list=firehol_L1 timeout=2d


do not remove spaces where are presents.
Code:
/ip firewall address-listremove [find where list=firehol_L1]:do {add addres=1.10.16.0/20 list=firehol_L1 timeout=2d} on-error={ }:do {add addres=1.19.0.0/16 list=firehol_L1 timeout=2d} on-error={ }:do {add addres=1.32.128.0/18 list=firehol_L1 timeout=2d} on-error={ }:do {add addres=2.56.192.0/22 list=firehol_L1 timeout=2d} on-error={ }

also this:
address=<redacted> host=<redacted> mode=https src-path=/blacklists/firehol1.rsc

full useless if you can do something like:
url="https://www.mysite.net/blacklists/firehol1.rsc"

full useless also all the useless ;


so the script change (also the IPs.....)

powershell code

"/ip firewall address-list" | Add-Content $script"remove [find where list=firehol_L1]" | Add-Content $script$blacklist= Get-Content "C:\inetpub\wwwroot\blacklists\firehol_L1.txt" | Where-Object {$_ -notmatch "^#|0.0.0.0|10.0.0.0|100.64.0.0|127.0.0.0|169.254.0.0|172.16.0.0|192.168.0.0|224.0.0.0"}ForEach ($address in $blacklist){":do {add addres=$address list=firehol_L1 timeout=2d} on-error={ }" | Add-Content $script

Statistics: Posted by rextended — Tue Mar 18, 2025 8:03 pm



Viewing all articles
Browse latest Browse all 21217

Trending Articles