mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-08-04 10:15:05 +02:00
global-functions: add $GetMacVendor
This commit is contained in:
parent
2505e5d42f
commit
ee5eefefc3
4 changed files with 21 additions and 24 deletions
|
@ -9,6 +9,7 @@
|
|||
:global "identity";
|
||||
|
||||
:global CertificateAvailable;
|
||||
:global GetMacVendor;
|
||||
:global SendNotification;
|
||||
|
||||
:local "place-before" [ / interface wireless access-list find where comment="--- collected above ---" disabled ];
|
||||
|
@ -37,14 +38,7 @@
|
|||
:local interface [ / interface wireless registration-table get $regentry interface ];
|
||||
:local ssid [ / interface wireless get [ find where name=$interface ] ssid ];
|
||||
:local datetime ([ / system clock get date ] . " " . [ / system clock get time ]);
|
||||
:local vendor;
|
||||
:do {
|
||||
$CertificateAvailable "Let's Encrypt Authority X3" "letsencrypt";
|
||||
:set vendor ([ / tool fetch mode=https check-certificate=yes-without-crl \
|
||||
url=("https://api.macvendors.com/" . [ :pick $mac 0 8 ]) output=user as-value ]->"data");
|
||||
} on-error={
|
||||
:set vendor "unknown vendor";
|
||||
}
|
||||
: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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue