mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
collect-wireless-mac: use $LogPrintExit
This commit is contained in:
parent
f90c59e4fb
commit
1dbd91f76d
3 changed files with 15 additions and 12 deletions
|
@ -9,6 +9,7 @@
|
|||
:global Identity;
|
||||
|
||||
:global GetMacVendor;
|
||||
:global LogPrintExit;
|
||||
:global ScriptLock;
|
||||
:global SendNotification;
|
||||
|
||||
|
@ -16,7 +17,7 @@ $ScriptLock "collect-wireless-mac.capsman";
|
|||
|
||||
:if ([ / caps-man access-list print count-only where comment="--- collected above ---" disabled ] = 0) do={
|
||||
/ caps-man access-list add comment="--- collected above ---" disabled=yes;
|
||||
:log warn "Added disabled access-list entry with comment '--- collected above ---'.";
|
||||
$LogPrintExit warn "Added disabled access-list entry with comment '--- collected above ---'." false;
|
||||
}
|
||||
:local PlaceBefore [ / caps-man access-list find where comment="--- collected above ---" disabled ];
|
||||
|
||||
|
@ -46,7 +47,7 @@ $ScriptLock "collect-wireless-mac.capsman";
|
|||
:local Vendor [ $GetMacVendor $Mac ];
|
||||
:local Message ("unknown MAC address " . $Mac . " (" . $Vendor . ", " . $HostName . ") " . \
|
||||
"first seen on " . $DateTime . " connected to SSID " . $Ssid . ", interface " . $Interface);
|
||||
/ log info $Message;
|
||||
$LogPrintExit info $Message false;
|
||||
/ caps-man access-list add place-before=$PlaceBefore comment=$Message mac-address=$Mac disabled=yes;
|
||||
$SendNotification ($Mac . " connected to " . $Ssid) \
|
||||
("A device with unknown MAC address connected to " . $Ssid . " on " . $Identity . ".\n\n" . \
|
||||
|
@ -60,7 +61,7 @@ $ScriptLock "collect-wireless-mac.capsman";
|
|||
"DNS name: " . $DnsName . "\n" . \
|
||||
"Date: " . $DateTime);
|
||||
} else={
|
||||
:local Comment [ / caps-man access-list get $AccessList comment ];
|
||||
:log debug ("MAC address " . $Mac . " already known: " . $Comment);
|
||||
$LogPrintExit debug ("MAC address " . $Mac . " already known: " . \
|
||||
[ / caps-man access-list get $AccessList comment ]) false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
:global Identity;
|
||||
|
||||
:global GetMacVendor;
|
||||
:global LogPrintExit;
|
||||
:global ScriptLock;
|
||||
:global SendNotification;
|
||||
|
||||
|
@ -16,7 +17,7 @@ $ScriptLock "collect-wireless-mac.local";
|
|||
|
||||
:if ([ / interface wireless access-list print count-only where comment="--- collected above ---" disabled ] = 0) do={
|
||||
/ interface wireless access-list add comment="--- collected above ---" disabled=yes;
|
||||
:log warn "Added disabled access-list entry with comment '--- collected above ---'.";
|
||||
$LogPrintExit warn "Added disabled access-list entry with comment '--- collected above ---'." false;
|
||||
}
|
||||
:local PlaceBefore [ / interface wireless access-list find where comment="--- collected above ---" disabled ];
|
||||
|
||||
|
@ -46,7 +47,7 @@ $ScriptLock "collect-wireless-mac.local";
|
|||
:local Vendor [ $GetMacVendor $Mac ];
|
||||
:local Message ("unknown MAC address " . $Mac . " (" . $Vendor . ", " . $HostName . ") " . \
|
||||
"first seen on " . $DateTime . " connected to SSID " . $Ssid . ", interface " . $Interface);
|
||||
/ log info $Message;
|
||||
$LogPrintExit info $Message false;
|
||||
/ interface wireless access-list add place-before=$PlaceBefore comment=$Message mac-address=$Mac disabled=yes;
|
||||
$SendNotification ($Mac . " connected to " . $Ssid) \
|
||||
("A device with unknown MAC address connected to " . $Ssid . " on " . $Identity . ".\n\n" . \
|
||||
|
@ -60,7 +61,7 @@ $ScriptLock "collect-wireless-mac.local";
|
|||
"DNS name: " . $DnsName . "\n" . \
|
||||
"Date: " . $DateTime);
|
||||
} else={
|
||||
:local Comment [ / interface wireless access-list get $AccessList comment ];
|
||||
:log debug ("MAC address " . $Mac . " already known: " . $Comment);
|
||||
$LogPrintExit debug ("MAC address " . $Mac . " already known: " . \
|
||||
[ / interface wireless access-list get $AccessList comment ]) false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
:global Identity;
|
||||
|
||||
:global GetMacVendor;
|
||||
:global LogPrintExit;
|
||||
:global ScriptLock;
|
||||
:global SendNotification;
|
||||
|
||||
|
@ -17,7 +18,7 @@ $ScriptLock "collect-wireless-mac%TEMPL%";
|
|||
|
||||
:if ([ / %PATH% access-list print count-only where comment="--- collected above ---" disabled ] = 0) do={
|
||||
/ %PATH% access-list add comment="--- collected above ---" disabled=yes;
|
||||
:log warn "Added disabled access-list entry with comment '--- collected above ---'.";
|
||||
$LogPrintExit warn "Added disabled access-list entry with comment '--- collected above ---'." false;
|
||||
}
|
||||
:local PlaceBefore [ / %PATH% access-list find where comment="--- collected above ---" disabled ];
|
||||
|
||||
|
@ -48,7 +49,7 @@ $ScriptLock "collect-wireless-mac%TEMPL%";
|
|||
:local Vendor [ $GetMacVendor $Mac ];
|
||||
:local Message ("unknown MAC address " . $Mac . " (" . $Vendor . ", " . $HostName . ") " . \
|
||||
"first seen on " . $DateTime . " connected to SSID " . $Ssid . ", interface " . $Interface);
|
||||
/ log info $Message;
|
||||
$LogPrintExit info $Message false;
|
||||
/ %PATH% access-list add place-before=$PlaceBefore comment=$Message mac-address=$Mac disabled=yes;
|
||||
$SendNotification ($Mac . " connected to " . $Ssid) \
|
||||
("A device with unknown MAC address connected to " . $Ssid . " on " . $Identity . ".\n\n" . \
|
||||
|
@ -62,7 +63,7 @@ $ScriptLock "collect-wireless-mac%TEMPL%";
|
|||
"DNS name: " . $DnsName . "\n" . \
|
||||
"Date: " . $DateTime);
|
||||
} else={
|
||||
:local Comment [ / %PATH% access-list get $AccessList comment ];
|
||||
:log debug ("MAC address " . $Mac . " already known: " . $Comment);
|
||||
$LogPrintExit debug ("MAC address " . $Mac . " already known: " . \
|
||||
[ / %PATH% access-list get $AccessList comment ]) false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue