From ee5eefefc3d7b256727581674f55f7d23e213a3f Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 27 Dec 2018 00:48:56 +0100 Subject: global-functions: add $GetMacVendor --- global-functions | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'global-functions') diff --git a/global-functions b/global-functions index a7beda6..041700c 100644 --- a/global-functions +++ b/global-functions @@ -92,3 +92,18 @@ } } } + +# get MAC vendor +:global GetMacVendor do={ + :local mac [ :tostr $1 ]; + + :do { + :local vendor; + $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"); + :return $vendor; + } on-error={ + :return "unknown vendor"; + } +} -- cgit v1.2.3-70-g09d2