Memblokir Mac Address Yang Berubah Pada Dinamik IP Hotspot Ver.6.xx

Mac Address

Berikut ini adalah sedikit tutorial bagaimana cara memblokir host dari mac address yang berubah-ubah pada hotspot versi.6.x keatas. Pada scripts dibawah ini copy kan ke /system Scripts :

:local hosts [/ip dhcp-server lease find]
:local pcname “”
:local pcnum 0
:global hacklist “”
# To log the value of $hacklist each hour, make debug 1 (if $hacklist is blank, nothing will be logged)
:local debug 1

:foreach h1 in=$hosts do={
:local host [/ip dhcp-server lease get $h1 host-name]
:if ([:len $host] >0) do {
:set pcname ($pcname . “,” . $host)
:set pcnum ($pcnum + 1)
}
}

:local pcnameArr [:toarray $pcname];

:foreach h2 in=$pcnameArr do={
:local hh 0
:if (!([:find $hacklist $h2]>=0)) do={
:foreach k in=$pcnameArr do={ :if ($k=$h2) do={:set hh ($hh + 1) } }
:if ($hh>2) do={
:if ([:len $hacklist] >0) do {:set hacklist ($hacklist . “,” . $h2)} else={:set hacklist $h2}
}
}
}

# monitor results in logfile once an hour
:local timer [:pick [/system clock get time] 3 5]
:if (($debug > 0) || ($timer >= “58”)) do={
:if ([:len $hacklist] >0) do={
:log warning (“New Hacklist: ” . $hacklist)
}
}
———————

:local host
:local ipnum
:local unum
:local usr
:local i
:global hacklist

:foreach host in=$hacklist do={
:foreach i in= [/ip dhcp-server lease find host-name=$host] do={
:set ipnum [/ip dhcp-server lease get $i address]
:set unum [/ip hotspot active find address=$ipnum]
:if ([:len $unum] >0) do {
:set usr [/ip hotspot active get $unum user]
:log warning ($host . ” ” . $ipnum . ” ” . $usr)
/ip hotspot active remove $unum
}
}
}

Itulah sedikit scripts yang digunakan untuk memblokir host dari mac address yang berubah-ubah pada hotspot versi 6.xx keatas, Salam kami sigernetwork.com