Hy. I want to block TOR with script, but it don`t add addresses
:local getIps do={
:local resp [/tool fetch http-method=get url=“https://check.torproject.org/torbulkexitlist” as-value output=user];
:if ($resp->“status” = “finished”) do={
:log info “TOR : getIps : Finished!”;
:return ($resp->“data”)
} else {
:log info “TOR : getIps : Failure”;
}
}
:local clearOldIps do={
:local listName $1;
:log info “$listName”;
:local IpsOld [:ip firewall address-list find where list=$listName];
:log info “TOR : clearOldIps : $[len $IpsOld]”;
:ip firewall address-list remove $IpsOld;
:log info “TOR : clearOldIps : Finished!”;
}
:local addNewIps do={
:local iocs [:toarray $1];
:log info “TOR : addNewIps : $[len $iocs]”;
:foreach ipp in $iocs do={
:ip firewall address-list add address=$ipp list=“TOR”;
};
:log info “TOR : addNewIps : Finished!”;
}
:do {
:log info “TOR : IOC (IP) : Start”;
:local iocs [$getIps];
:log info “TOR : IOC (IP) : clearOldIps”;
$clearOldIps “TOR”;
:log info “TOR : IOC (IP) : addNewIps”;
$addNewIps $iocs;
:log info “TOR : IOC (IP) : Stop”;
} on-error={
:log info “TOR : IOC (IP) : Error: $ErrVar”;
}