From 7aa2d69ce6b8f1e721d56920e8b80285be851530 Mon Sep 17 00:00:00 2001 From: Matt W <436037+mlw@users.noreply.github.com> Date: Thu, 2 Nov 2023 20:30:05 -0400 Subject: [PATCH] Add OnStartUSBOptions to santactl status (#1219) --- Source/santactl/Commands/SNTCommandStatus.m | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/santactl/Commands/SNTCommandStatus.m b/Source/santactl/Commands/SNTCommandStatus.m index 75725a949..9e3a2fe88 100644 --- a/Source/santactl/Commands/SNTCommandStatus.m +++ b/Source/santactl/Commands/SNTCommandStatus.m @@ -15,11 +15,22 @@ #import #import +#import "Source/common/SNTCommonEnums.h" #import "Source/common/SNTConfigurator.h" #import "Source/common/SNTXPCControlInterface.h" #import "Source/santactl/SNTCommand.h" #import "Source/santactl/SNTCommandController.h" +NSString *StartupOptionToString(SNTDeviceManagerStartupPreferences pref) { + switch (pref) { + case SNTDeviceManagerStartupPreferencesUnmount: return @"Unmount"; + case SNTDeviceManagerStartupPreferencesForceUnmount: return @"ForceUnmount"; + case SNTDeviceManagerStartupPreferencesRemount: return @"Remount"; + case SNTDeviceManagerStartupPreferencesForceRemount: return @"ForceRemount"; + default: return @"None"; + } +} + @interface SNTCommandStatus : SNTCommand @end @@ -195,6 +206,7 @@ - (void)runWithArguments:(NSArray *)arguments { @"remount_usb_mode" : (configurator.blockUSBMount && configurator.remountUSBMode.count ? configurator.remountUSBMode : @""), + @"on_start_usb_options" : StartupOptionToString(configurator.onStartUSBOptions), }, @"database" : @{ @"binary_rules" : @(binaryRuleCount), @@ -252,9 +264,10 @@ - (void)runWithArguments:(NSArray *)arguments { printf(" %-25s | %s\n", "File Logging", (fileLogging ? "Yes" : "No")); printf(" %-25s | %s\n", "USB Blocking", (configurator.blockUSBMount ? "Yes" : "No")); if (configurator.blockUSBMount && configurator.remountUSBMode.count > 0) { - printf(" %-25s | %s\n", "USB Remounting Mode:", + printf(" %-25s | %s\n", "USB Remounting Mode", [[configurator.remountUSBMode componentsJoinedByString:@", "] UTF8String]); } + printf(" %-25s | %s\n", "On Start USB Options", StartupOptionToString(configurator.onStartUSBOptions).UTF8String); printf(" %-25s | %lld (Peak: %.2f%%)\n", "Watchdog CPU Events", cpuEvents, cpuPeak); printf(" %-25s | %lld (Peak: %.2fMB)\n", "Watchdog RAM Events", ramEvents, ramPeak);