aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-12-27 00:48:56 +0100
committerGravatar Christian Hesse <mail@eworm.de>2018-12-27 00:48:56 +0100
commitee5eefefc3d7b256727581674f55f7d23e213a3f (patch)
tree1478d0c77fb04c77dc04d4ac2fa7e95687819ec3 /global-functions
parent2505e5d42f872b5f8a4ef7e5ca42ecadb16ccdee (diff)
global-functions: add $GetMacVendor
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions15
1 files changed, 15 insertions, 0 deletions
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";
+ }
+}