global-functions: add $GetMacVendor

This commit is contained in:
Christian Hesse 2018-12-27 00:48:56 +01:00
parent 2505e5d42f
commit ee5eefefc3
4 changed files with 21 additions and 24 deletions

View file

@ -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";
}
}