Community discussions

 
User avatar
mohmadtnnari
just joined
Topic Author
Posts: 7
Joined: Sun Jan 17, 2016 11:46 pm
Location: syria-idleb
Contact:

remove user from address list When logout from active

Sun Jan 14, 2018 7:28 pm

hello

i have script in hotspot > user > profile> onlogin that script add all user on active to firewall > address list

i need script add in onlogout for remove user from address list When logout from active

my script at onlogin
{
:delay 500ms
:local x $user;
:local y [/ip hotspot active get [find user=$x] address];
:local f [/ip hotspot host get [find to-address=$y] address];
:local c [/ip hotspot active get [find user=$x] login-by];
:local b "http-pap";
:local k "http-chap";
:local v "cookie";
:local n [/ip dhcp-server lease get [find active-address=$f] host-name];
:local s [/ip dhcp-server lease get [find active-address=$f] mac-address];
:local r [/ip dhcp-server lease get [find active-address=$f] client-id];
if (c =  b || c = k || c = v) do={
:log warning "$x تسجيل دخول صحيح"
if ( [ :len [ ip firewall address-list find where list="$f$n$s$r" ] ] = 0 ) do={
/ip firewall address-list add list="$f$n$s$r" comment=$user 
/ip dhcp-server lease make-static [find active-address=$f]
/ip dhcp-server lease set [find active-address=$f] comment="$user"}} else={
if ( [ :len [ ip firewall address-list find where list="$f$n$s$r" ] ] > 0 ) do={ :log warning "$x تسجيل دخول صحيح باستخدام الماك" } else={
ip hotspot active remove [find user=$x] 
:log warning "$x محاولة اختراق حساب"
/ip firewall address-list add list="$user - Account" comment="$n - $s - حساب مخترق"
}}}
 
User avatar
Taym
just joined
Posts: 1
Joined: Sun Oct 21, 2018 2:03 pm
Location: syria-idleb
Contact:

Re: remove user from address list When logout from active

Fri Nov 02, 2018 10:09 pm

Hi master mohamad
Test the script in hotspot > user profile> onlogout
{
:delay 500ms
if ( [ :len [ ip firewall address-list find where comment=$user ] ] >= 1 ) do={
/ip firewall address-list remove [find comment=$user]
}}

Who is online

Users browsing this forum: No registered users and 4 guests