Page 1 of 1

Please help in writing the script.

Posted: Wed Jan 09, 2019 9:16 pm
by simonflex
I'm new, I have trouble writing a script. Please help in writing the script.
There is an address-list as_1 as_2 as_3. It is necessary to add all the ip address in the new address list with a check,
for example allow_list_ip. After checking, if the address is missing, then add, if the address was deleted from ~as_,then
delete from allow_list_ip
:foreach ipaddr in= [/ip fi add  print as-value where list~"as_"] do={:put ($ipaddr->"address")}

Re: Please help in writing the script.

Posted: Wed Jan 09, 2019 10:26 pm
by Jotne
Why?

It may be an other way to solve your problem.

Re: Please help in writing the script.

Posted: Thu Jan 10, 2019 3:25 am
by simonflex
Why?

It may be an other way to solve your problem.
I assume that it is possible to solve differently. Write 20 rules or more, and make changes with your hands. Such tips have already given me .....
I have a home network, and RB-951 ROS 6.43.8
I want to create my own list of trusted and untrusted networks and ip. And then decide what to do with a certain traffic.
For example: I created address lists to track traffic as_apple as_google as_amazon as_microsoft and so on
I added a rule in mangle
ch=forward action=add-src-to-address-list src-address-list=!allow_list_ip address-list=ip_src_frwd_new address-list-timeout=none-dynamic in-interface=ether1
after that there will be thousands of addresses. And how to understand them? And so I added src-address-list=!allow_list_ip and for this my need to fill this address list from my ~as_ address-list
for this task I decided to write a script. I am not a programmer. And for a beginner without skills it is difficult to do this. And perhaps this decision will be needed by many. Thank