Now my problem is that if there is more than one in the list, the following error message is sent:
invalid internal item number
And here is the script:
Code: Select all
{
/system
:local systemName [identity get name]
:local dateBlock [clock get date]
:local timeBlock [clock get time]
:local emlAdd "mail@mail.hu"
:local EmailText ""
:local ipaddress "192.168.89.*"
:local blacklist "brute_forcers_blacklist"
/ip firewall address-list
:foreach i in=[find where list="internal"] do={
:if ([:len [get [find address~$ipaddress list=$blacklist] address]] > 0) do={
:local ipf [get [find where list=$blacklist and address~$ipaddress] address]
:set EmailText ($EmailText."IP $ipf Has been added to the BlackList\r\n")
:put "cause";
:do {
/tool e-mail send to=$emlAdd subject="$systemName Security Notice" \
body="$systemName Security Notice\r\nRunning Time: $dateBlock - $timeBlock\r\n\r\n$EmailText"
} on-error={
:log error "$systemName Security Notice: Failed to send email."
}
}
:put $ipaddress
}
}
What am I messing up?
Thank you in advance for your help!