Community discussions

MikroTik App

Search found 15 matches

by Shumkov
Mon Feb 22, 2021 10:42 am
Forum: General
Topic: Problems: Changes to Static DNS causing serious issues.
Replies: 20
Views: 4874

Re: Problems: Changes to Static DNS causing serious issues.

Before FWD was implemented, I used layer7+NAT to conditionally forward DNS requests. This is a working example of a regex: /ip firewall layer7-protocol add name=opennic regexp="(\\x03bbs|\\x04chan|\\x03cyb|\\x03dyn|\\x04epic|\\x04geek|\\x06gopher|\\x04indy|\\x05libre|\\x03neo|\\x04null|\\x01o|\...
by Shumkov
Sat Nov 28, 2020 9:01 am
Forum: Scripting
Topic: Feature request: logical operator "in" for IP ranges
Replies: 1
Views: 446

Feature request: logical operator "in" for IP ranges

put (192.168.0.1 in 192.168.0.0/24)
Output:
true
put (192.168.0.1 in 192.168.0.1-192.168.0.254)
Output:
false

Why?

This feature can be useful if you need to check if a conditional IP address is included in an IP pool consisting of several address ranges.
by Shumkov
Sun Nov 22, 2020 10:17 am
Forum: Scripting
Topic: Find and replace IP address in IP services
Replies: 1
Views: 198

Re: Find and replace IP address in IP services

ip service :foreach value in=[find address] do={ :foreach address in=[get $value address] do={:put "$address -> $[:pick $address 0 [:find $address /]]/28"} } Output: X.X.X.X/X -> X.X.X.X/28 This is the basic algorithm. Now you can modify the script according to your requirements (replace ...
by Shumkov
Thu Nov 05, 2020 8:49 am
Forum: Scripting
Topic: Cumbersome fetching the key in an array and duplicating arrays
Replies: 3
Views: 451

Re: Cumbersome fetching the key in an array

Two-dimensional array?
[admin@MikroTik] >> local ar {{"Abcdef";"a"};{"c";"d"}};put ($ar->0->0);put ($ar->1->0)
Abcdef
c
by Shumkov
Sat May 30, 2020 7:25 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

You should be aware that when loading lists IF a duplicate IP is present the list will not load and processing stops.
Script ignores duplicates via on-error={}, processing is not interrupted.
by Shumkov
Fri May 29, 2020 9:52 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

What is the recommended way to find out *why* an update failed? Address list <Spamhaus DROP> update failed Is great to see in the logs, but where do I look to try and figure out why it failed? This error occurs if the file is for some reason not available for download. The address list does not loa...
by Shumkov
Thu Mar 12, 2020 2:05 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

Bugfix:
- correct regexp is "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"

The bug is not critical, it’s just that in some cases the script could process strings containing not only IP addresses, but simply numerical combinations similar in format.
by Shumkov
Thu Mar 05, 2020 10:36 am
Forum: Scripting
Topic: how to detect or allow duplicate ips in firewall address lists
Replies: 3
Views: 2605

Re: how to detect or allow duplicate ips in firewall address lists

RouterOS does not allow duplicates in the same address list. But when loading a list of addresses containing duplicates, you can use an error handler: ip firewall address-list :do {add list=<list> address=<address>} on-error={} :do {add list=<list> address=<address>} on-error={} :do {add list=<list>...
by Shumkov
Tue Mar 03, 2020 8:15 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

With the above script can I properly (full lists) download the below lists?
Download full lists - you can’t. 63KiB is a limitation of RouterOS, here scripts are powerless.
by Shumkov
Tue Mar 03, 2020 5:06 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

Variant 2 : ip firewall address-list :local update do={ :do { :local data ([:tool fetch url=$url output=user as-value]->"data") :local array [find dynamic list=blacklist] :foreach value in=$array do={:set array (array,[get $value address])} :while ([:len $data]!=0) do={ :if ([:pick $data ...
by Shumkov
Fri Nov 08, 2019 9:30 am
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

Do you have a dedicated link the fullbogons piece? I cannot seem to fined a direct url for it? Fullbogons_IPv4: http://www.team-cymru.org/Services/Bogons/fullbogons-ipv4.txt All bogon lists: https://www.team-cymru.com/bogon-reference-http.html Bogons via BGP: https://www.team-cymru.com/bogon-refere...
by Shumkov
Thu Nov 07, 2019 12:41 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

Is there a way to check the file size and have it trigger the email tool if it gets beyond the max file size?
You can try this:
if (([tool fetch url=<url> output=user as-value]->"total")>63) do={tool e-mail send ...}
by Shumkov
Mon Nov 04, 2019 9:51 am
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

It would be nice if this would be possible using a filter to have only the needed data in the variable. So there would be a lot more space in the variable This does not work :) " data " is an element of the array, and is accepted for processing only in its entirety - you cannot process on...
by Shumkov
Sun Nov 03, 2019 8:39 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Re: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

Do not forget about file size - maximum 63 KiB . If the file size is larger than the maximum, only part of the file will be processed ( the first 63 KiB ), and the rest of the file will be discarded. FireHOL Level2 is bigger than 63 KiB :) What is general recommendation on how often to grab new list...
by Shumkov
Tue Oct 01, 2019 11:00 pm
Forum: Scripting
Topic: Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)
Replies: 82
Views: 20768

Address lists downloader (DShield, Spamhaus DROP/EDROP, etc)

Hello! The new parameter " output=user " provided new scripting capabilities that I decided to take full advantage of. - the script does not need third-party servers, since address lists are downloaded directly from the source and processed directly on the router . - the script does NOT sa...