Skip to content

Commit

Permalink
Make santactl status always print out transitive rule status if set (#…
Browse files Browse the repository at this point in the history
…1277)

* Make santactl status always print out transitive rule status even when not using a sync service.

* Fix typo in SNTCommandRule.m.

* Updated JSON values to put transitive_rules in the daemon section.
  • Loading branch information
pmarkowsky authored Jan 22, 2024
1 parent 3b7061e commit f4ad76b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/santactl/Commands/SNTCommandRule.m
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ - (void)exportJSONFile:(NSString *)jsonFilePath {
NSMutableArray *rulesAsDicts = [[NSMutableArray alloc] init];

for (SNTRule *rule in rules) {
// Omit transitive and remove rules as they're not relevan.
// Omit transitive and remove rules as they're not relevant.
if (rule.state == SNTRuleStateAllowTransitive || rule.state == SNTRuleStateRemove) {
continue;
}
Expand Down
8 changes: 6 additions & 2 deletions Source/santactl/Commands/SNTCommandStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ - (void)runWithArguments:(NSArray *)arguments {
@"daemon" : @{
@"driver_connected" : @(YES),
@"mode" : clientMode ?: @"null",
@"transitive_rules" : @(enableTransitiveRules),
@"log_type" : eventLogType,
@"file_logging" : @(fileLogging),
@"watchdog_cpu_events" : @(cpuEvents),
Expand Down Expand Up @@ -229,7 +230,6 @@ - (void)runWithArguments:(NSArray *)arguments {
@"last_successful_rule" : ruleSyncLastSuccessStr ?: @"null",
@"push_notifications" : pushNotifications ? @"Connected" : @"Disconnected",
@"bundle_scanning" : @(enableBundles),
@"transitive_rules" : @(enableTransitiveRules),
},
} mutableCopy];

Expand Down Expand Up @@ -262,6 +262,11 @@ - (void)runWithArguments:(NSArray *)arguments {
} else {
printf(">>> Daemon Info\n");
printf(" %-25s | %s\n", "Mode", [clientMode UTF8String]);

if (enableTransitiveRules) {
printf(" %-25s | %s\n", "Transitive Rules", (enableTransitiveRules ? "Yes" : "No"));
}

printf(" %-25s | %s\n", "Log Type", [eventLogType UTF8String]);
printf(" %-25s | %s\n", "File Logging", (fileLogging ? "Yes" : "No"));
printf(" %-25s | %s\n", "USB Blocking", (blockUSBMount ? "Yes" : "No"));
Expand Down Expand Up @@ -310,7 +315,6 @@ - (void)runWithArguments:(NSArray *)arguments {
printf(" %-25s | %s\n", "Push Notifications",
(pushNotifications ? "Connected" : "Disconnected"));
printf(" %-25s | %s\n", "Bundle Scanning", (enableBundles ? "Yes" : "No"));
printf(" %-25s | %s\n", "Transitive Rules", (enableTransitiveRules ? "Yes" : "No"));
}

if (exportMetrics) {
Expand Down

0 comments on commit f4ad76b

Please sign in to comment.