summaryrefslogtreecommitdiffstats
path: root/src/detection/chassis/chassis_apple.c
diff options
context:
space:
mode:
authorsumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
committersumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
commit76424950e373d3b04ac3dd13019151bfba3e8423 (patch)
tree4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/detection/chassis/chassis_apple.c
Add the files
Diffstat (limited to 'src/detection/chassis/chassis_apple.c')
-rw-r--r--src/detection/chassis/chassis_apple.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/detection/chassis/chassis_apple.c b/src/detection/chassis/chassis_apple.c
new file mode 100644
index 0000000..1ff4fee
--- /dev/null
+++ b/src/detection/chassis/chassis_apple.c
@@ -0,0 +1,40 @@
+#include "chassis.h"
+#include "detection/host/host.h"
+
+const char* ffDetectChassis(FFChassisResult* result) {
+ FFHostResult host = {
+ .family = ffStrbufCreate(),
+ .name = ffStrbufCreate(),
+ .version = ffStrbufCreate(),
+ .sku = ffStrbufCreate(),
+ .serial = ffStrbufCreate(),
+ .uuid = ffStrbufCreate(),
+ .vendor = ffStrbufCreate(),
+ };
+ if (ffDetectHost(&host) != NULL) {
+ return "Failed to detect host";
+ }
+
+ if (ffStrbufStartsWithS(&host.name, "MacBook ")) {
+ ffStrbufSetStatic(&result->type, "Laptop");
+ } else if (ffStrbufStartsWithS(&host.name, "Mac mini ") ||
+ ffStrbufStartsWithS(&host.name, "Mac Studio ")) {
+ ffStrbufSetStatic(&result->type, "Mini PC");
+ } else if (ffStrbufStartsWithS(&host.name, "iMac ")) {
+ ffStrbufSetStatic(&result->type, "All in One");
+ } else {
+ ffStrbufSetStatic(&result->type, "Desktop");
+ }
+
+ ffStrbufSet(&result->vendor, &host.vendor);
+
+ ffStrbufDestroy(&host.family);
+ ffStrbufDestroy(&host.name);
+ ffStrbufDestroy(&host.version);
+ ffStrbufDestroy(&host.sku);
+ ffStrbufDestroy(&host.serial);
+ ffStrbufDestroy(&host.uuid);
+ ffStrbufDestroy(&host.vendor);
+
+ return NULL;
+}