Last active
January 14, 2025 03:30
-
-
Save elico/ce829a33f6eb288b64738aca138e86c4 to your computer and use it in GitHub Desktop.
An example of domains check with regex in the dns cache of mikrotik
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:foreach i in=[/ip dns cache find name~"(youtube-ui.l.google.com|youtube.com|googlevideo.com)\$" && $type ~ "^(A|CNAME)\$" ] do={ | |
:local tmpAddress [/ip dns cache get $i data]; | |
:local cacheName [/ip dns cache get $i name] ; | |
delay delay-time=10ms | |
:if ( [/ip firewall address-list find where address=$tmpAddress list=YOUTUBE_DOMAINS ] = "") do={ | |
:log info ("added entry: $cacheName $tmpAddress"); | |
/ip firewall address-list add address=$tmpAddress list=YOUTUBE_DOMAINS comment=$cacheName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment