diff --git a/AppDelegate.m b/AppDelegate.m index a73dc98..275feb1 100755 --- a/AppDelegate.m +++ b/AppDelegate.m @@ -20,9 +20,6 @@ //TODO: autolayout vertically //TODO: show 'from where' via quarantine attrz or database!! (simon email) //TODO: detect as procs die via GCD (simon blog post) -//TODO: missing icon (128) - new icon? -//TODO: exception handling for mutated array! -//TODO: check for "Apple Mac OS Application Signing" for Apple Apps - and add to 'OBJ-See' TODO doc @implementation AppDelegate @@ -270,17 +267,6 @@ break; - //'i' (info) - //case KEYCODE_I: - - //info - //TODO...this will take some work, search, flagged, item.... - - //set flag - //wasHandled = YES; - - //break; - //'w' (close window) case KEYCODE_W: @@ -1746,9 +1732,6 @@ bail: //unselect current task self.currentTask = nil; - //TODO: don't reset filtered items? - // ...will require some smart filtering :/ - //unset filter flag self.taskTableController.isFiltered = NO; diff --git a/Exception.h b/Exception.h index ba3038d..641fe85 100755 --- a/Exception.h +++ b/Exception.h @@ -17,4 +17,8 @@ void signalHandler(int signal, siginfo_t *info, void *context); //display an alert void showAlert(); +//given an error reason (e.g. '*** Collection <__NSArrayM: 0x7fdb36a72b80> was mutated while being enumerated' +// ->extract and grab objective-c object's description; 0x7fdb36a72b80 (NSArray*) +void displayObject(NSException* exception); + diff --git a/Exception.m b/Exception.m index d719de2..3f9bce2 100755 --- a/Exception.m +++ b/Exception.m @@ -80,6 +80,9 @@ void exceptionHandler(NSException *exception) //err msg syslog(LOG_ERR, "OBJECTIVE-SEE ERROR: %s", [[[NSThread callStackSymbols] description] UTF8String]); + //try print any objective-c objects in exception's 'reason' + displayObject(exception); + //main thread // ->just show UI alert if(YES == [NSThread isMainThread]) @@ -153,3 +156,67 @@ void signalHandler(int signal, siginfo_t *info, void *context) return; } + +//given an error reason (e.g. '*** Collection <__NSArrayM: 0x7fdb36a72b80> was mutated while being enumerated' +// ->extract and grab objective-c object's description; 0x7fdb36a72b80 (NSArray*) +void displayObject(NSException* exception) +{ + //object description + NSString* objectDescription = nil; + + //start + NSRange start = {0}; + + //end + NSRange end = {0}; + + //extracted addr + NSString* extractedAddr = nil; + + //scanner + // ->used to convert hex string to pointer + NSScanner* scanner = nil; + + //address + unsigned long long objAddress = 0; + + //find start + // ->find '0x' in something like: *** Collection <__NSArrayM: 0x7fdb36a72b80> + start = [exception.reason rangeOfString:@"0x"]; + if(NSNotFound == start.location) + { + //bail + goto bail; + } + + //find end + // ->find '>' in something like: *** Collection <__NSArrayM: 0x7fdb36a72b80> + end = [exception.reason rangeOfString:@">"]; + if(NSNotFound == end.location) + { + //bail + goto bail; + } + + //extract address + // ->will still be a (hex) string, but will be converted below + extractedAddr = [exception.reason substringWithRange:NSMakeRange(start.location + start.length, end.location - start.location- start.length)]; + + //init scanner + scanner = [NSScanner scannerWithString:extractedAddr]; + + //convert extracted address from hex string to pointer + [scanner scanHexLongLong:&objAddress]; + + //cast to obj-c object + // ->then get description + objectDescription = [(__bridge_transfer NSArray*)((void*)objAddress) description]; + + //err msg + syslog(LOG_ERR, "OBJECTIVE-SEE ERROR: object: %s", [objectDescription UTF8String]); + +//bail +bail: + + return; +} diff --git a/RequestRootWindowController.h b/RequestRootWindowController.h index fcaeaf7..f5c3f4c 100644 --- a/RequestRootWindowController.h +++ b/RequestRootWindowController.h @@ -18,6 +18,9 @@ //auth button @property (weak) IBOutlet NSButton *authButton; +//cancel button +@property (weak) IBOutlet NSButton *cancelButton; + //arrow icon @property (weak) IBOutlet NSImageView *arrowIcon; diff --git a/RequestRootWindowController.m b/RequestRootWindowController.m index 239e841..e0bc4a8 100644 --- a/RequestRootWindowController.m +++ b/RequestRootWindowController.m @@ -19,6 +19,7 @@ @synthesize statusMsg; @synthesize authButton; @synthesize shouldExit; +@synthesize cancelButton; //automatically called when nib is loaded // ->center window @@ -76,9 +77,6 @@ // ->auth user, then set XPC service as root/setuid -(IBAction)authenticate:(id)sender { - //status var - BOOL authdOK = NO; - //authorization ref AuthorizationRef authorizationRef = {0}; @@ -154,8 +152,6 @@ //2nd arg: permissions // ->note: 4 at front is setuid - //TODO: change b4 release - // ->make 4755 before deploy (for testing, 777 makes Xcode be able to del it during build!) installArgs[1] = "4755"; //3rd arg: XPC service @@ -166,8 +162,6 @@ //chmod XPC service w/ setuid osStatus = AuthorizationExecuteWithPrivileges(authorizationRef, "/bin/chmod", 0, (char* const*)installArgs, NULL); - - //check if(errAuthorizationSuccess != osStatus) { //err msg @@ -182,23 +176,46 @@ //bail goto bail; } - - //no errors - authdOK = YES; - + //no exit self.shouldExit = NO; - //make sure app's key window is (still) font - [((AppDelegate*)[[NSApplication sharedApplication] delegate]).window makeKeyAndOrderFront:self]; + //disable auth button + self.authButton.enabled = NO; - //make sure app is (still) front - [NSApp activateIgnoringOtherApps:YES]; + //disable cancel button + self.cancelButton.enabled = NO; - //call back into app delegate - // ->kick off task enum, etc - [((AppDelegate*)[[NSApplication sharedApplication] delegate]) go]; + //update auth message + self.statusMsg.stringValue = @"ok: authorization successful"; + //wait a bit + // ->then hide window & kick off action + { + + //dispatch, then action + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.50 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + + //close window + [self.window close]; + + //exec UI actions etc on main thread + dispatch_async(dispatch_get_main_queue(), ^{ + + //make sure app's key window is (still) font + [((AppDelegate*)[[NSApplication sharedApplication] delegate]).window makeKeyAndOrderFront:self]; + + //make sure app is (still) front + [NSApp activateIgnoringOtherApps:YES]; + + //call back into app delegate + // ->kick off task enum, etc + [((AppDelegate*)[[NSApplication sharedApplication] delegate]) go]; + + }); + }); + + } //bail bail: @@ -210,13 +227,7 @@ bail: AuthorizationFree(authorizationRef, kAuthorizationFlagDestroyRights); } - //on auth/'install' success - // ->close window - if(YES == authdOK) - { - //close window - [self.window close]; - } + return; } diff --git a/Task.m b/Task.m index 790aa6b..2a81fc4 100644 --- a/Task.m +++ b/Task.m @@ -304,8 +304,8 @@ bail: for(NSString* dylibPath in dylibPaths) { //skip main executable image - //TODO: also check realpath() or obj-c equiv! - if(YES == [dylibPath isEqualToString:self.binary.path]) + // ->making sure to resolve symlinks + if(YES == [dylibPath isEqualToString:[self.binary.path stringByResolvingSymlinksInPath]]) { //skip continue; diff --git a/TaskExplorer-Info.plist b/TaskExplorer-Info.plist index d3a8e7b..411f227 100755 --- a/TaskExplorer-Info.plist +++ b/TaskExplorer-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.3.0 + 1.4.0 CFBundleSignature ???? CFBundleVersion - 1.3.0 + 1.4.0 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright diff --git a/TaskExplorer.xcodeproj/project.xcworkspace/xcshareddata/KnockKnock.xccheckout b/TaskExplorer.xcodeproj/project.xcworkspace/xcshareddata/KnockKnock.xccheckout deleted file mode 100644 index 0ced272..0000000 --- a/TaskExplorer.xcodeproj/project.xcworkspace/xcshareddata/KnockKnock.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 1ECDBF86-1DFC-4002-A5BE-41FC31ACB68B - IDESourceControlProjectName - project - IDESourceControlProjectOriginsDictionary - - A9FFC1B124E25027A0E10FB456DBA9E2803FAE9D - https://bitbucket.org/objective-see/knockknock.git - - IDESourceControlProjectPath - KnockKnock.xcodeproj/project.xcworkspace - IDESourceControlProjectRelativeInstallPathDictionary - - A9FFC1B124E25027A0E10FB456DBA9E2803FAE9D - ../.. - - IDESourceControlProjectURL - https://bitbucket.org/objective-see/knockknock.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - A9FFC1B124E25027A0E10FB456DBA9E2803FAE9D - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - A9FFC1B124E25027A0E10FB456DBA9E2803FAE9D - IDESourceControlWCCName - KnockKnock - - - - diff --git a/TaskTableController.m b/TaskTableController.m index ce9067b..b1e34e2 100644 --- a/TaskTableController.m +++ b/TaskTableController.m @@ -6,25 +6,18 @@ // Copyright (c) 2015 Objective-See. All rights reserved. // -//TODO: list of what's running on my Mac on website!!!! - +#import "KKRow.h" #import "Binary.h" #import "Consts.h" +#import "ItemBase.h" #import "ItemView.h" #import "VTButton.h" - - +#import "kkRowCell.h" #import "Utilities.h" #import "AppDelegate.h" -#import "ItemBase.h" #import "TaskTableController.h" #import "InfoWindowController.h" -#import "KKRow.h" -#import "kkRowCell.h" - -#import - @implementation TaskTableController @synthesize itemView; @@ -823,7 +816,7 @@ bail: //draw [selectedView setNeedsDisplay:YES]; - //make hide it after .33 second + //make hidden it after .33 second dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.33 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ //reset color diff --git a/UI/RequestRootWindow.xib b/UI/RequestRootWindow.xib index 3326eab..152955e 100644 --- a/UI/RequestRootWindow.xib +++ b/UI/RequestRootWindow.xib @@ -1,14 +1,15 @@ - + - + + @@ -19,7 +20,7 @@ - + @@ -47,7 +48,7 @@ - +