Skip to content

Instantly share code, notes, and snippets.

@Pliner Pliner/import
Last active Oct 31, 2019

Embed
What would you like to do?
Mikrotik antifilter.download update script
:do {
:do {
/file remove "/ipsum.rsc";
/file remove "/subnet.rsc";
} on-error={}
:put "Downloading ipsum.rsc...";
:do {
/tool fetch url="https://antifilter.download/list/ipsum.rsc" dst-path="/ipsum.rsc"
} on-error={
:put "Error. Download failed";
}
:put "Downloading subnet.rsc...";
:do {
/tool fetch url="https://antifilter.download/list/subnet.rsc" dst-path="/subnet.rsc"
} on-error={
:put "Error. Download failed";
}
/ip firewall address-list remove [/ip firewall address-list find list=rkn]
:put "Importing ipsum.rsc...";
:do {
/import "/ipsum.rsc";
} on-error={
:put "import failed. unknown error.";
}
:put "Importing subnet.rsc...";
:do {
/import "/subnet.rsc";
} on-error={
:put "import failed. unknown error.";
}
:put "Update Complete.";
}
@furriest

This comment has been minimized.

Copy link

furriest commented Sep 23, 2019

На antifilter.download появился allyouneed.rsc, который суммаризует ipsum и subnet и исключает ошибку из-за повторений в этих списках. Скрипт можно и нужно переписать под его использование.

@mms101

This comment has been minimized.

Copy link

mms101 commented Sep 25, 2019

/system script remove [find name=Antifilter]
/system script add name=Antifilter owner=admin policy=
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="{\r
\n\r
\n :local FileName "allyouneed.rsc";\r
\n :do {\r
\n :do {\r
\n /file remove "/$FileName";\r
\n } on-error={}\r
\n\r
\n :put "Downloading $FileName...";\r
\n :log warning "Downloading $FileName...";\r
\n :do {\r
\n /tool fetch url="https://antifilter.download/list/\$FileName\" dst-path="/$FileName"\r
\n } on-error={\r
\n :put "Error. Download $FileName failed";\r
\n :log error "Error. Download $FileName failed";\r
\n :return 0;\r
\n }\r
\n\r
\n /ip firewall address-list remove [/ip firewall address-list find list=rkn]\r
\n\r
\n :put "Importing $FileName...";\r
\n :log warning "Importing $FileName...";\r
\n :do {\r
\n /import "/$FileName";\r
\n } on-error={\r
\n :put "Import $FileName failed. unknown error.";\r
\n :log error "Import $FileName failed. unknown error.";\r
\n }\r
\n\r
\n :put "Update rkn address-list completed.";\r
\n :log warning "Update rkn address-list completed.";\r
\n }\r
\n}"

/system scheduler add name=Antifilter comment=Antifilter on-event=Antifilter interval=24h start-time=03:00:00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.