Community discussions

 
pokeman
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Jun 05, 2009 10:52 pm

1st script with too many error !

Wed Apr 01, 2009 10:25 am

Hi there

i am trying to grep windows update ips from dns cache. can anyone help me out !


:foreach i in= /ip firewall address-list remove [/ip firewall address-list find list=windowsupdate][/ip dns cache find] do={n;log find [/ip dns cache get $i name] "windowsupdate"} > 0) do={info (windowsupdate:[ /ip dns cache get $i name] [/ip address {/ip firewall address-list add }] address [/ip dns cache get \$i address\] list=windowsupdate}
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5942
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: 1st script with too many error !

Wed Apr 01, 2009 10:34 am

I can't even understand what you wanted to do with that script.
 
pokeman
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Jun 05, 2009 10:52 pm

Re: 1st script with too many error !

Wed Apr 01, 2009 11:30 am

I can't even understand what you wanted to do with that script.

The Perpose of this script grep windowsupdate host ips from dns cache and add to firewall address-list
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5942
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: 1st script with too many error !

Wed Apr 01, 2009 11:37 am

You can't tell that from the code above :)

anyway here is the script that should work, modify it for your needs
{
 :foreach i in=[/ip dns cache find] do={
    :local cacheName [/ip dns cache all get $i name] ;
    :if ([:find $cacheName "windowsupdate"] != 0) do={
         :local tmpAddress [/ip dns cache get $i address] ;
         /ip firewall address-list add address=$tmpAddress list=windowsupdate disabled=no;
    }
}
 
pokeman
Member Candidate
Member Candidate
Topic Author
Posts: 136
Joined: Fri Jun 05, 2009 10:52 pm

Re: 1st script with too many error !

Wed Apr 01, 2009 12:53 pm

Thanks its working :)

Who is online

Users browsing this forum: arslana143 and 19 guests