Hotspot Users
تحويل القائمة السوداء إلى حظر MAC في الهوتسبوت — v6 & v7
مكمّل لقواعد الحماية من التخمين: لكل IP في قائمة hotspot_blacklist يجد عنوان MAC من جدول ARP ويضيف IP Binding دائم من نوع blocked لهذا الـ MAC ثم يحذف الـ IP من القائمة. مفيد عندما تكون مدة DHCP قصيرة ويحصل المخترق على IP جديد.
RouterOS v6 & v7
/system script add name=hotspot_blacklist_to_mac source={
# EN: Every dynamic entry in the brute-force blacklist | AR: كل عنصر ديناميكي في القائمة السوداء
:foreach e in=[/ip firewall address-list find where list=hotspot_blacklist dynamic=yes] do={
:local ip [/ip firewall address-list get $e address];
# EN: Find the MAC of this IP in the ARP table | AR: إيجاد الـ MAC لهذا الـ IP من جدول ARP
:local arp [/ip arp find where address=$ip];
:if ([:len $arp] > 0) do={
:local mac [/ip arp get [:pick $arp 0] mac-address];
# EN: Add the block binding once | AR: إضافة الحظر مرة واحدة فقط
:if ([:len [/ip hotspot ip-binding find where mac-address=$mac type=blocked]] = 0) do={
/ip hotspot ip-binding add type=blocked mac-address=$mac comment="blocked by brute-force script";
}
/ip firewall address-list remove $e;
:log warning ("Hotspot: blocked MAC " . $mac . " (" . $ip . ")");
}
}
}
# EN: Run it every minute so it acts before the 3h blacklist entry expires | AR: تشغيله كل دقيقة ليعمل قبل انتهاء مدة القائمة السوداء (3 ساعات)
/system scheduler add name=hotspot_blacklist_to_mac interval=1m on-event=hotspot_blacklist_to_mac