From ead177b3a9cf13cf66a087d7d8c56fa0dce9626d Mon Sep 17 00:00:00 2001 From: vados-dev <192440777+vados-dev@users.noreply.github.com> Date: Fri, 1 May 2026 03:00:03 +0300 Subject: [PATCH] Autocommit in repo: ros.vados.ru, generated by owner: root, in 03:00:02 01.05.2026. --- html/AM-GlobalFunc.rsc | 4 +- html/func-collection/git/README.md | 2 +- .../git/updateVPNList/README.md | 1 + .../git/updateVPNList/dnsLookup | 67 +++++++++++++++++++ .../git/updateVPNList/updateVPNList | 20 ++++++ html/func-collection/git/vados-dev.github.io | 1 - 6 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 html/func-collection/git/updateVPNList/README.md create mode 100644 html/func-collection/git/updateVPNList/dnsLookup create mode 100644 html/func-collection/git/updateVPNList/updateVPNList delete mode 160000 html/func-collection/git/vados-dev.github.io diff --git a/html/AM-GlobalFunc.rsc b/html/AM-GlobalFunc.rsc index 18c461060..5c7798e5f 100644 --- a/html/AM-GlobalFunc.rsc +++ b/html/AM-GlobalFunc.rsc @@ -17,9 +17,9 @@ :global GlobalFuncReady false; # Git commit id & info, expected configuration version -:global CommitId "main/329/d1d1be7e"; +:global CommitId "main/330/d3b01a82"; :global CommitTAG "unknown"; -:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 02:55:02 01.05.2026."; +:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 03:00:02 01.05.2026."; # The variables are received right here. :global GlobalConfVersion 138; diff --git a/html/func-collection/git/README.md b/html/func-collection/git/README.md index 43ad0aca5..106163b0e 100644 --- a/html/func-collection/git/README.md +++ b/html/func-collection/git/README.md @@ -1,6 +1,6 @@ # Git commands, examples, links and help -- [⬅️ Go back to section README ](/func-collection//README.md) +- [⬅️ Go back to section README ](/func-collection/README.md) --- ### * diff --git a/html/func-collection/git/updateVPNList/README.md b/html/func-collection/git/updateVPNList/README.md new file mode 100644 index 000000000..c611d8c3e --- /dev/null +++ b/html/func-collection/git/updateVPNList/README.md @@ -0,0 +1 @@ +Just add both scripts to your Mikrotik setup and put `updateVPNList` script on a schedule. \ No newline at end of file diff --git a/html/func-collection/git/updateVPNList/dnsLookup b/html/func-collection/git/updateVPNList/dnsLookup new file mode 100644 index 000000000..7262c4887 --- /dev/null +++ b/html/func-collection/git/updateVPNList/dnsLookup @@ -0,0 +1,67 @@ +:global ListName +:global Servers +:global Done + +#has $Done been initialized? +:if ([:typeof $Done] != "boolean") do={ + :set Done true; +} + +#make sure previous runs have finished +while (!$Done) do={ + :nothing; +} + +#block any other runs +:set Done false; + +#delete old address lists +:foreach aListItem in=[/ip firewall address-list find list=$ListName] do={ + /ip firewall address-list remove $aListItem; +} + +:foreach aServer in=$Servers do={ +#force the dns entries to be cached + :do { + :resolve $aServer; + } on-error={ + :log error "dns resolve failure [ ip - resolve ip ]" + } + + :foreach dnsRecord in=[/ip dns cache all find where (name=$aServer)] do={ +#if it's an A records add it directly + :if ([/ip dns cache all get $dnsRecord type]="A") do={ + :local newAddress [/ip dns cache all get $dnsRecord data]; + :do { + /ip firewall address-list add list=$ListName address=$newAddress comment=$aServer; + } on-error={ + :log error "error when adding ip to list: $newAddress" + } + } + +#if it's a CNAME follow it until we get A records + :if ([/ip dns cache all get $dnsRecord type]="CNAME") do={ + :local cname; + :local nextCname + :set cname [/ip dns cache all find where (name=$aServer && type="CNAME")]; + :set nextCname [/ip dns cache all find where (name=[/ip dns cache all get $cname data] && type="CNAME")]; + + :while ($nextCname != "") do={ + :set cname $nextCname; + :set nextCname [/ip dns cache all find where (name=[/ip dns cache all get $cname data] && type="CNAME")]; + } + +#add the a records we found + :foreach aRecord in=[/ip dns cache all find where (name=[/ip dns cache all get $cname data] && type="A")] do={ + :do { + /ip firewall address-list add list=$ListName address=[/ip dns cache all get $aRecord data] comment=$aServer; + } on-error={ + :log error "error when adding ip to list: $newAddress" + } + } + } + } +} + +#allow other scripts to call this +:set Done true \ No newline at end of file diff --git a/html/func-collection/git/updateVPNList/updateVPNList b/html/func-collection/git/updateVPNList/updateVPNList new file mode 100644 index 000000000..cdd3f9958 --- /dev/null +++ b/html/func-collection/git/updateVPNList/updateVPNList @@ -0,0 +1,20 @@ +:global Servers { +# Feel free to use your own unblock list ;) +"telegra.ph"; +"grani.ru"; +"xhamster.com"; +"kasparov.ru"; +"lostfilm.tv"; +"rutracker.org"; +"lurkmore.to"; +"dou.ua"; +"youporn.com"; +"pornolab.net"; +"crimerussia.com"; +"telegram.org"; +"telegram.me"; +"t.me"; +} +:global ListName VPN + +/system script run dnsLookup \ No newline at end of file diff --git a/html/func-collection/git/vados-dev.github.io b/html/func-collection/git/vados-dev.github.io deleted file mode 160000 index 1a0f849a4..000000000 --- a/html/func-collection/git/vados-dev.github.io +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1a0f849a4eaf012eaead44751adfb00a01cfeb46 -- 2.52.0