diff --git a/3rdParty/OrderedDictionary.h b/3rdParty/OrderedDictionary.h index 9fe72ac..aac2e73 100644 --- a/3rdParty/OrderedDictionary.h +++ b/3rdParty/OrderedDictionary.h @@ -36,4 +36,7 @@ - (NSEnumerator *)reverseKeyEnumerator; -(void)reverse; +//sort, by object key +-(void)sort:(NSString*)sortKey; + @end diff --git a/3rdParty/OrderedDictionary.m b/3rdParty/OrderedDictionary.m index 37ae20a..c6b208c 100644 --- a/3rdParty/OrderedDictionary.m +++ b/3rdParty/OrderedDictionary.m @@ -133,6 +133,23 @@ NSString *DescriptionForObject(NSObject *object, id locale, NSUInteger indent) array = [[[array reverseObjectEnumerator] allObjects] mutableCopy]; } +//sort, by object key +-(void) :(NSString*)sortKey +{ + //task sorted by name + NSArray* sortedTasks = nil; + + //sort task by binary name + sortedTasks = [[dictionary allValues] sortedArrayUsingSelector:@selector(compare:)]; + + //extract pids into array + array = [[sortedTasks valueForKey:@"pid"] mutableCopy]; + + return; +} + + + /* - (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level { diff --git a/Consts.h b/Consts.h index 63540f3..c34fd0e 100644 --- a/Consts.h +++ b/Consts.h @@ -30,6 +30,7 @@ //keys for signing stuff #define KEY_SIGNATURE_STATUS @"signatureStatus" #define KEY_SIGNING_AUTHORITIES @"signingAuthorities" +#define KEY_SIGNING_IS_APPLE @"signedByApple" //OS version x #define OS_MAJOR_VERSION_X 10 diff --git a/ItemView.m b/ItemView.m index 1715267..bf61b04 100644 --- a/ItemView.m +++ b/ItemView.m @@ -433,8 +433,15 @@ NSImage* getCodeSigningIcon(Binary* binary) //set signature status icon if(nil != binary.signingInfo) { + //binary is signed by apple + if(YES == [binary.signingInfo[KEY_SIGNING_IS_APPLE] boolValue]) + { + //set + codeSignIcon = [NSImage imageNamed:@"signedAppleIcon"]; + } + //binary is signed - if(STATUS_SUCCESS == [binary.signingInfo[KEY_SIGNATURE_STATUS] integerValue]) + else if(STATUS_SUCCESS == [binary.signingInfo[KEY_SIGNATURE_STATUS] integerValue]) { //set codeSignIcon = [NSImage imageNamed:@"signed"]; @@ -676,7 +683,10 @@ NSTableCellView* createNetworkView(NSTableView* tableView, id owner, Connection* goto bail; } - //set icon + //reset icon + connectionCell.imageView.image = nil; + + //set icon for TCP sockets //TODO: (re)set default icon!? if(nil != connection.state) { @@ -694,6 +704,14 @@ NSTableCellView* createNetworkView(NSTableView* tableView, id owner, Connection* } } + //set icon for UDP sockets + // ->can't listen, so just show em as streaming + else if(YES == [connection.type isEqualToString:@"SOCK_DGRAM"]) + { + //set + connectionCell.imageView.image = [NSImage imageNamed:@"streamIcon"]; + } + //default // ->(re)set main textfield's color to black connectionCell.textField.textColor = [NSColor blackColor]; @@ -715,11 +733,22 @@ NSTableCellView* createNetworkView(NSTableView* tableView, id owner, Connection* [connectionCell.textField setStringValue:endpoints]; //set details + // ->TCP socket if(nil != connection.state) { //add state [details appendString:connection.state]; } + //set details + // ->UDP socket + else if(YES == [connection.type isEqualToString:@"SOCK_DGRAM"]) + { + //bound + // ->add state + [details appendString:@"bound (UDP) socket"]; + + //TODO: connected UDP socket? + } //set details [[connectionCell viewWithTag:TABLE_ROW_SUB_TEXT_TAG] setStringValue:details]; diff --git a/Task.h b/Task.h index 6da231a..b0a09ad 100644 --- a/Task.h +++ b/Task.h @@ -27,7 +27,7 @@ struct dyld_image_info_32 { NSNumber* pid; //uid - uid_t uid; + //uid_t uid; //main binary Binary* binary; diff --git a/Task.m b/Task.m index 7882d3c..e194140 100644 --- a/Task.m +++ b/Task.m @@ -529,6 +529,11 @@ bail: } +- (NSComparisonResult)compare:(Task*)otherTask +{ + return [self.binary.name compare:otherTask.binary.name options:NSCaseInsensitiveSearch]; +} + diff --git a/TaskEnumerator.h b/TaskEnumerator.h index 8049199..5fec2a9 100644 --- a/TaskEnumerator.h +++ b/TaskEnumerator.h @@ -59,7 +59,7 @@ //determine if dylibs should be (re)enumerated // ->generally yes, unless the first enumeration (of all tasks) is not complete --(BOOL)shouldEnumDylibs; +//-(BOOL)shouldEnumDylibs; @end diff --git a/TaskEnumerator.m b/TaskEnumerator.m index a892e18..50b16bf 100644 --- a/TaskEnumerator.m +++ b/TaskEnumerator.m @@ -97,9 +97,6 @@ // ->call back into app delegate to update task (top) table // call every x # of seconds~ -//TODO: re-enumerate dylibs for everytime! -// only need to update task.dylibs list (not global one, unless its new!) - -(void)enumerateTasks { //(new) task item @@ -137,10 +134,11 @@ //[newTask enumerateDylibs:self.xpcConnection allDylibs:self.dylibs]; //add new task - // TODO: ordering!? [self.tasks setObject:newTask forKey:newTask.pid]; - } + }//add new tasks + + //sort by name! //reload table [((AppDelegate*)[[NSApplication sharedApplication] delegate]) reloadTaskTable]; @@ -167,79 +165,6 @@ return; } -/* -//determine if dylibs should be (re)enumerated -// ->generally yes, unless the first enumeration (of all tasks) is not complete --(BOOL)shouldEnumDylibs -{ - //flag - BOOL shouldEnum = NO; - - //task key - NSNumber* taskKey = nil; - - //Task - Task* task = nil; - - for(NSInteger i = self.tasks.count-1; i>=0; i--) - { - taskKey = [self.tasks keyAtIndex:i]; - - task = self.tasks[taskKey]; - - //skip dead procs - if(YES != isAlive([task.pid unsignedIntValue])) - { - continue; - } - - //alive - // ->does it have dylibs? - if(0 != task.dylibs.count) - { - //a end task has dylibs - // ->indicates all done? - shouldEnum = YES; - - //bail - break; - } - else - { - shouldEnum = NO; - - break; - } - } - - return shouldEnum; -} -*/ - -/* -//TODO: only do this once! -// ->otherwise done JIT (on click) -//TODO: sync!! -//iterate over all tasks -// ->invoke task's emun method to get all files/network (via XPC) --(void)enumerateFiles -{ - //Task - Task* task = nil; - - //iterate over all tasks - // ->invoke method to enumerate files - for(NSNumber* key in self.tasks) - { - //get task - task = self.tasks[key]; - - //enumerate files - [task enumerateFiles:self.xpcConnection]; - } -} -*/ - //get list of all pids -(OrderedDictionary*)getAllTasks { @@ -336,9 +261,8 @@ //add kernel task [allTasks setObject:task forKey:@0]; - //reverse array - // ->want order to go from 0 -> ... - [allTasks reverse]; + //sort all tasks alphabetically + [allTasks sort:@"name"]; //bail bail: diff --git a/TaskExplorer.xcodeproj/project.pbxproj b/TaskExplorer.xcodeproj/project.pbxproj index efcc53d..a85edde 100755 --- a/TaskExplorer.xcodeproj/project.pbxproj +++ b/TaskExplorer.xcodeproj/project.pbxproj @@ -36,6 +36,9 @@ CD4D541F1B2CE6C400008030 /* Queue.m in Sources */ = {isa = PBXBuildFile; fileRef = CD4D541E1B2CE6C400008030 /* Queue.m */; }; CD4D54221B2CE6F200008030 /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = CD4D54211B2CE6F200008030 /* NSMutableArray+QueueAdditions.m */; }; CD4D54241B2D082300008030 /* DylibInfoWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD4D54231B2D082300008030 /* DylibInfoWindow.xib */; }; + CD4D54261B2EA94C00008030 /* streamIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = CD4D54251B2EA94C00008030 /* streamIcon.png */; }; + CD4D54281B2EAC7800008030 /* NetworkInfoWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CD4D54271B2EAC7800008030 /* NetworkInfoWindow.xib */; }; + CD4D543F1B2FF32C00008030 /* signedAppleIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = CD4D543E1B2FF32C00008030 /* signedAppleIcon.png */; }; CD6095731A87067D00E091CD /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD6095721A87067D00E091CD /* Security.framework */; }; CD6E54FF1B1162B5007953AB /* ItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = CD6E54FE1B1162B5007953AB /* ItemView.m */; }; CD7B9F4D1ACB959200DF3C71 /* logoAppleOver.png in Resources */ = {isa = PBXBuildFile; fileRef = CD7B9F4C1ACB959200DF3C71 /* logoAppleOver.png */; }; @@ -171,6 +174,9 @@ CD4D54201B2CE6F200008030 /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+QueueAdditions.h"; sourceTree = ""; }; CD4D54211B2CE6F200008030 /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+QueueAdditions.m"; sourceTree = ""; }; CD4D54231B2D082300008030 /* DylibInfoWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = DylibInfoWindow.xib; path = UI/DylibInfoWindow.xib; sourceTree = ""; }; + CD4D54251B2EA94C00008030 /* streamIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = streamIcon.png; path = images/streamIcon.png; sourceTree = SOURCE_ROOT; }; + CD4D54271B2EAC7800008030 /* NetworkInfoWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = NetworkInfoWindow.xib; path = UI/NetworkInfoWindow.xib; sourceTree = ""; }; + CD4D543E1B2FF32C00008030 /* signedAppleIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = signedAppleIcon.png; path = images/signedAppleIcon.png; sourceTree = SOURCE_ROOT; }; CD6095721A87067D00E091CD /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; CD6E54FD1B1162B5007953AB /* ItemView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ItemView.h; sourceTree = ""; }; CD6E54FE1B1162B5007953AB /* ItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ItemView.m; sourceTree = ""; }; @@ -378,6 +384,8 @@ CD6095501A8329FA00E091CD /* images */ = { isa = PBXGroup; children = ( + CD4D543E1B2FF32C00008030 /* signedAppleIcon.png */, + CD4D54251B2EA94C00008030 /* streamIcon.png */, CD4D53D11B23ED4300008030 /* listeningIcon.png */, CD4D53CF1B23ED3900008030 /* connectedIcon.png */, CD4D53C91B20296E00008030 /* unknown.png */, @@ -493,6 +501,7 @@ CDA81E621AA020E8009790E2 /* UI */ = { isa = PBXGroup; children = ( + CD4D54271B2EAC7800008030 /* NetworkInfoWindow.xib */, CD4D54231B2D082300008030 /* DylibInfoWindow.xib */, CDA5F6C01B16E1D6003CE340 /* RequestRootWindow.xib */, CD3F4D151AF89066002A2647 /* TreeView.xib */, @@ -614,9 +623,11 @@ CD7B9FA81ACCAE5E00DF3C71 /* stopScanOver.png in Resources */, CDA81D701A95B4E9009790E2 /* stopScan.png in Resources */, CDF08CF01ACA677B009B3423 /* kernelIcon.png in Resources */, + CD4D54261B2EA94C00008030 /* streamIcon.png in Resources */, CDF08CD01AC4C6E8009B3423 /* settingsBG.png in Resources */, CD0219551AD34E4C005148A2 /* kkIcon.png in Resources */, CD0219591AD37748005148A2 /* unsigned2.png in Resources */, + CD4D54281B2EAC7800008030 /* NetworkInfoWindow.xib in Resources */, CDA81D5C1A95B4B4009790E2 /* MainMenu.xib in Resources */, CD7B9F4D1ACB959200DF3C71 /* logoAppleOver.png in Resources */, CD0219581AD37748005148A2 /* signed2.png in Resources */, @@ -634,6 +645,7 @@ CDAB98A31AEB413C00C75B4B /* dylibIcon.png in Resources */, CDF08CC31AC3E98D009B3423 /* infoOver.png in Resources */, CDF08CF41ACA6864009B3423 /* loginIcon.png in Resources */, + CD4D543F1B2FF32C00008030 /* signedAppleIcon.png in Resources */, CD3F4D161AF89066002A2647 /* TreeView.xib in Resources */, CD0219501AD34D8B005148A2 /* PrefsWindow.xib in Resources */, CDA81D6C1A95B4E9009790E2 /* showBG.png in Resources */, diff --git a/TaskExplorer.xcodeproj/xcuserdata/patrick.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/TaskExplorer.xcodeproj/xcuserdata/patrick.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 5c40477..4d881fa 100644 --- a/TaskExplorer.xcodeproj/xcuserdata/patrick.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/TaskExplorer.xcodeproj/xcuserdata/patrick.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -196,11 +196,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "TaskTableController.m" - timestampString = "455935914.851075" + timestampString = "456129885.389119" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "985" - endingLineNumber = "985" + startingLineNumber = "995" + endingLineNumber = "995" landmarkName = "-showInfo:" landmarkType = "5"> @@ -237,5 +237,53 @@ landmarkType = "5"> + + + + + + + + + + + + diff --git a/TaskTableController.m b/TaskTableController.m index 83267dc..a3a7481 100644 --- a/TaskTableController.m +++ b/TaskTableController.m @@ -40,8 +40,18 @@ -(void)awakeFromNib { self.selectedRow = -1; + + /* + NSString *title = @"[ all tasks ]"; + NSTableColumn *yourColumn = self.itemView.tableColumns.lastObject; + [yourColumn.headerCell setStringValue:title]; + + [self.itemView setIndicatorImage:[NSImage imageNamed:@"NSDescendingSortIndicator"] inTableColumn:self.itemView.tableColumns.lastObject]; + + */ } + /* //invoked automatically while nib is loaded // ->note: outlets are nil here... diff --git a/UI/DylibInfoWindow.xib b/UI/DylibInfoWindow.xib index d78588e..a7f96d1 100644 --- a/UI/DylibInfoWindow.xib +++ b/UI/DylibInfoWindow.xib @@ -20,7 +20,7 @@ - + diff --git a/UI/FlatView.xib b/UI/FlatView.xib index f18a488..d9ecca1 100755 --- a/UI/FlatView.xib +++ b/UI/FlatView.xib @@ -412,8 +412,35 @@ + + + + + + + + + + + + + + @@ -437,7 +464,7 @@ -