From eda89ba64391dc6b41c7d9762656143caad1f77b Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 14 Dec 2018 12:35:06 +0100 Subject: collect-wireless-mac: get and record the vendor --- collect-wireless-mac.template | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'collect-wireless-mac.template') diff --git a/collect-wireless-mac.template b/collect-wireless-mac.template index 784bfb9..59b2e72 100644 --- a/collect-wireless-mac.template +++ b/collect-wireless-mac.template @@ -9,6 +9,7 @@ :global "identity"; +:global CertificateAvailable; :global SendNotification; :local "place-before" [ / %PATH% access-list find where comment="--- collected above ---" disabled ]; @@ -38,8 +39,16 @@ :local ssid [ / caps-man registration-table get $regentry ssid ]; :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; / %PATH% access-list add place-before=$"place-before" comment=$message mac-address=$mac disabled=yes; $SendNotification ($mac . " connected to " . $ssid) \ @@ -48,6 +57,7 @@ "Interface: " . $interface . "\n" . \ "SSID: " . $ssid . "\n" . \ "MAC: " . $mac . "\n" . \ + "Vendor: " . $vendor . "\n" . \ "Hostname: " . $hostname . "\n" . \ "Address: " . $address . "\n" . \ "Date: " . $datetime); -- cgit v1.2.3-70-g09d2