Untitled
2 months ago in Plain Text
/tool fetch url="https://hole.cert.pl/domains/domains.txt"
{
:local dstAddressCert "195.187.6.34"
:local comment "HoleCertDomains"
:local content [/file get [/file find name=domains.txt] contents] ;
:local contentLen [:len $content];
:local lineEnd 0;
:local line "";
:local lastEnd 0;

:while ($lineEnd < $contentLen) do={
# depending on file type (linux/windows), "\n" might need to be "\r\n"
:set lineEnd [:find $content "\n" $lastEnd];
# if there are no more line breaks, set this to be the last one
:if ([:len $lineEnd] = 0) do={
:set lineEnd $contentLen;
}
# get the current line based on the last line break and next one
:set line [:pick $content $lastEnd $lineEnd];
# depending on "\n" or "\r\n", this will be 1 or 2 accordingly
:set lastEnd ($lineEnd + 1);
# don't process blank lines
:if ($line != "\r") do={
/ip dns static add name=$line add=$dstAddressCert comment=$comment
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27