Script to log firewall address list

Hi, i was attempt to type a script that show me and log the firewall address list (Static and Dynamic IP’s ), but it does not run.
Any help will be appreciated :smiley:

hi
i want to look your script

or i don’t know how to hlep you , is this ???

:foreach a in=[/ip firewall address-list find dynamic=yes] do={
:local dyip [/ip firewall address-list get $a address];
:log warning ("the dynamic ip is : ".$dyip)}
:foreach a in=[/ip firewall address-list find dynamic=no] do={
:local stip [/ip firewall address-list get $a address];
:log warning ("the static ip is : ".$stip)}

That’s it:(I watch it in a web site)

/system script
add name=“spammers” source=“:log error "----------Users detected like
SPAMMERS -------------";
\n:foreach i in [/ip firewall address-list find
list=spammer] do={:set usser [/ip firewall address-list get $i
address];
\n:foreach j in=[/ip hotspot active find address=$usser]
do={:set ip [/ip hotspot active get $j user];
\n:log error $ip;
\n:log
error $usser} };” policy=ftp,read,write,policy,test,winbox

Can i watch the result from LOG button ???

yes ,click the log you will find

Hi huigezi, i type the script as in the photo, but it still not work. Any mistake i did???
mik.JPG

ip address-list must have some dynamic or static address
1.jpg

It still unwork, please look at the script on my photo, is it ok ???
I appreciate your response to solve this problem. :frowning:
mik22.JPG

Should i do something here ???
mik23.JPG

click the [run script] or copy the script to the [system scheduler] for certain interval time run

huigezi, i would like to thank you so much, it’s work fine now. :smiley:

Hi guys,

I try to run the script in order that one of the address-lists (name ftp_blacklist) can be sent by mail:

:foreach a in=[/ip firewall address-list find list=ftp_blacklist] do={
:local ftp [/ip firewall address-list get $a address];
/tool e-mail send from=xxx@gmail.com to=zzzz@gmail.com tls=yes server=74.125.91.108 port=587 password=xxx subject="I get the attacker" body=$ftp

there is no mail error log & script run count was increase.
Dis I wrong in “body=$ftp” section?

appreciate for your help