From 150dc4441086ae708b892b43eb9bf03f1d0e7776 Mon Sep 17 00:00:00 2001 From: Patrick Wardle Date: Thu, 8 Dec 2022 10:58:15 -1000 Subject: [PATCH] improved built-in device detection + improved parsing on macOS 12 parsing of log messages on macOS 12 improved internal / build-in mic/camera detection improved --- .../Application.xcodeproj/project.pbxproj | 4 - Application/Application/AVMonitor.m | 305 +++++++++++------- 2 files changed, 182 insertions(+), 127 deletions(-) diff --git a/Application/Application.xcodeproj/project.pbxproj b/Application/Application.xcodeproj/project.pbxproj index 33d73bb..666f930 100644 --- a/Application/Application.xcodeproj/project.pbxproj +++ b/Application/Application.xcodeproj/project.pbxproj @@ -34,7 +34,6 @@ CDC60991263CBD36006D1332 /* AVMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = CDC60990263CBD36006D1332 /* AVMonitor.m */; }; CDC60994263CBEE7006D1332 /* Client.m in Sources */ = {isa = PBXBuildFile; fileRef = CDC60993263CBEE7006D1332 /* Client.m */; }; CDCBF0DE26499DFF001D9F9A /* Event.m in Sources */ = {isa = PBXBuildFile; fileRef = CDCBF0DD26499DFF001D9F9A /* Event.m */; }; - CDE09AF729198BA800561CFF /* OverSight Installer.app in Resources */ = {isa = PBXBuildFile; fileRef = CDE09AF629198BA800561CFF /* OverSight Installer.app */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -98,7 +97,6 @@ CDC60993263CBEE7006D1332 /* Client.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Client.m; sourceTree = ""; }; CDCBF0DC26499DFF001D9F9A /* Event.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Event.h; sourceTree = ""; }; CDCBF0DD26499DFF001D9F9A /* Event.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Event.m; sourceTree = ""; }; - CDE09AF629198BA800561CFF /* OverSight Installer.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = "OverSight Installer.app"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -218,7 +216,6 @@ CDE09AF12919829000561CFF /* Uninstaller */ = { isa = PBXGroup; children = ( - CDE09AF629198BA800561CFF /* OverSight Installer.app */, ); path = Uninstaller; sourceTree = ""; @@ -296,7 +293,6 @@ buildActionMask = 2147483647; files = ( CD8FD5D523BAE2D200EFE0FB /* Preferences.xib in Resources */, - CDE09AF729198BA800561CFF /* OverSight Installer.app in Resources */, CD6836682391DB6F00CF19C1 /* security.plist in Resources */, CD2F800C24455333009C3D77 /* AboutWindow.xib in Resources */, 7D16D6951F64E43300DB3161 /* UpdateWindow.xib in Resources */, diff --git a/Application/Application/AVMonitor.m b/Application/Application/AVMonitor.m index fa6fa24..af6b7e3 100644 --- a/Application/Application/AVMonitor.m +++ b/Application/Application/AVMonitor.m @@ -157,118 +157,158 @@ extern os_log_t logHandle; //start logging [self.logMonitor start:[NSPredicate predicateWithFormat:@"subsystem=='com.apple.SystemStatus'"] level:Log_Level_Default callback:^(OSLogEvent* logEvent) { - //flags - BOOL audioAttributionsList = NO; - BOOL cameraAttributionsList = NO; - - //new audio attributions - NSMutableArray* newAudioAttributions = nil; - - //new camera attributions - NSMutableArray* newCameraAttributions = nil; - //dbg msg - os_log_debug(logHandle, "log message from 'com.apple.SystemStatus'"); - - //only interested on "Server data changed..." msgs - if(YES != [logEvent.composedMessage containsString:@"Server data changed for media domain"]) - { - return; - } - - //dbg msg - //os_log_debug(logHandle, "new (video) client msg: %{public}@", logEvent.composedMessage); - - //split on newlines - // ...and then parse out audio/camera attributions - for(NSString* __strong line in [logEvent.composedMessage componentsSeparatedByString:@"\n"]) - { - //pid - NSNumber* pid = 0; - - //trim - line = [line stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - - //audioAttributions list? - if(YES == [line hasPrefix:@"audioAttributions = "]) - { - //set flag - audioAttributionsList = YES; - - //init - newAudioAttributions = [NSMutableArray array]; - - //unset (other) list - cameraAttributionsList = NO; - - //next - continue; - } - - //cameraAttributions list? - if(YES == [line hasPrefix:@"cameraAttributions = "]) - { - //set flag - cameraAttributionsList = YES; - - //init - newCameraAttributions = [NSMutableArray array]; - - //unset (other) list - audioAttributionsList = NO; - - //next - continue; - } - - //audit token of item? - if(YES == [line containsString:@"