aboutsummaryrefslogtreecommitdiffstats
path: root/collect-wireless-mac.local
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-12-14 12:35:06 +0100
committerGravatar Christian Hesse <mail@eworm.de>2018-12-14 12:35:06 +0100
commiteda89ba64391dc6b41c7d9762656143caad1f77b (patch)
tree37ec10329c411cc89653e1167b67be13413afb6e /collect-wireless-mac.local
parent65283ce76d87f02e1eb47ace91a6c93192c0f108 (diff)
collect-wireless-mac: get and record the vendor
Diffstat (limited to 'collect-wireless-mac.local')
-rw-r--r--collect-wireless-mac.local14
1 files changed, 12 insertions, 2 deletions
diff --git a/collect-wireless-mac.local b/collect-wireless-mac.local
index 3416046..d6ece7d 100644
--- a/collect-wireless-mac.local
+++ b/collect-wireless-mac.local
@@ -8,6 +8,7 @@
:global "identity";
+:global CertificateAvailable;
:global SendNotification;
:local "place-before" [ / interface wireless access-list find where comment="--- collected above ---" disabled ];
@@ -36,8 +37,16 @@
: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 message ("unknown MAC address " . $mac . " (" . $hostname . ") first seen on " . \
- $datetime . " connected to SSID " . $ssid . ", interface " . $interface);
+ :local vendor;
+ :do {
+ $CertificateAvailable "731d3d9cfaa061487a1d71445a42f67df0afca2a6c2d2f98ff7b3ce112b1f568";
+ :set vendor ([ / tool fetch mode=https check-certificate=yes-without-crl \
+ url=("https://api.macvendors.com/" . $mac) output=user as-value ]->"data");
+ } on-error={
+ :set vendor "unknown vendor";
+ }
+ :local message ("unknown MAC address " . $mac . " (" . $vendor . ", " . $hostname . ") " . \
+ "first seen on " . $datetime . " connected to SSID " . $ssid . ", interface " . $interface);
/ log info $message;
/ interface wireless access-list add place-before=$"place-before" comment=$message mac-address=$mac disabled=yes;
$SendNotification ($mac . " connected to " . $ssid) \
@@ -46,6 +55,7 @@
"Interface: " . $interface . "\n" . \
"SSID: " . $ssid . "\n" . \
"MAC: " . $mac . "\n" . \
+ "Vendor: " . $vendor . "\n" . \
"Hostname: " . $hostname . "\n" . \
"Address: " . $address . "\n" . \
"Date: " . $datetime);