Skip to content

Commit

Permalink
Now showing multiple endpoints for sockets & endpoint for pipes (when…
Browse files Browse the repository at this point in the history
… lookup succeeds). Also, releasing 2.8, updated appcast, verison, docs, links etc.
  • Loading branch information
sveinbjornt committed Mar 27, 2019
1 parent 70ad377 commit 91b6b74
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 54 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Sloth is free, open source software and has been developed and maintained for a

## Download

* **[⇩ Download Sloth 2.7](https://sveinbjorn.org/files/software/sloth.zip)** (~0.6 MB, Intel 64-bit, macOS 10.8 or later)
* **[⇩ Download Sloth 2.8](https://sveinbjorn.org/files/software/sloth.zip)** (~0.7 MB, Intel 64-bit, macOS 10.8 or later)

Sloth can also be installed via [Homebrew](https://brew.sh):

Expand All @@ -35,6 +35,21 @@ $ brew cask install sloth

## Version history

### 27/03/2019 - Version 2.8

* New Dark Mode friendly template icons for Mojave
* Multiple items can now be selected and copied
* Info Panel now shows which processes are connected to each other via unix pipes & domain sockets
* Info Panel now also shows file system info such as device name & inode
* Cmd-L menu action to show selected item
* Minor performance improvements
* Sparkle update framework now has Mojave Dark Mode-compatible appearance
* No longer shows hidden volumes in Volumes filter
* Fixed issue with mangled process names
* Fixed issue with pipe icon on non-retina displays
* Fixed minor memory leak
* More graceful error handling when file descriptor lookup fails in lsof

### 10/02/2019 - Version 2.7

* Info Panel now shows file Uniform Type Identifier
Expand Down
16 changes: 0 additions & 16 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@

TODO for Sloth 2.9
* Spin off Lsof task and parsing into separate class, document the parsing and data structure produced


TODO list for Sloth 2.8
DONE * New Dark Mode friendly template icons for Mojave
DONE * Multiple items can now be selected and copied
DONE * Cmd-L menu action to show selected item
DONE * Minor performance improvements
DONE * Sparkle update framework now Mojave Dark Mode-compatible
DONE * No longer shows hidden volumes (e.g. "/private/var/vm"") in Volumes filter
DONE * Fixed issue with mangled process names
DONE * Fixed issue with pipe icon on non-retina displays
DONE * Fixed minor memory leak
DONE * Handle errors where file descriptor is unavailable
DONE * Filter by device id, not just using mount path prefix
DONE * Show file system info (device name & inode) in Info Panel
* Show which processes are connected via pipes & unix domain sockets
6 changes: 3 additions & 3 deletions source/InfoPanelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ - (void)loadItem:(NSDictionary *)itemDict {

// Show endpoints for pipes and unix domain sockets
self.pathLabelTextField.stringValue = isPipeOrSocket ? @"Connected to" : @"Path";
if (isPipeOrSocket && itemDict[@"endpointname"]) {
NSString *epString = [NSString stringWithFormat:@"%@ (%@)", itemDict[@"endpointname"], itemDict[@"endpointpid"]];
[self.pathTextField setStringValue:epString];
if (isPipeOrSocket && [itemDict[@"endpoints"] count]) {
NSString *eps = [itemDict[@"endpoints"] componentsJoinedByString:@"\n"];
[self.pathTextField setStringValue:eps];
}

// Icon
Expand Down
54 changes: 28 additions & 26 deletions source/SlothController.m
Original file line number Diff line number Diff line change
Expand Up @@ -531,32 +531,34 @@ - (NSMutableArray *)parseLsofOutput:(NSString *)outputString numFiles:(int *)num
*numFiles += [process[@"children"] count];

// Iterate over the process's children, map sockets and pipes to their endpoint
// for (NSMutableDictionary *f in process[@"children"]) {
// if (![f[@"type"] isEqualToString:@"Unix Domain Socket"] && ![f[@"type"] isEqualToString:@"Pipe"]) {
// continue;
// }
// // Pipes and sockets should have names in the format "->[NAME]"
// if ([f[@"name"] length] < 3) {
// continue;
// }
//
// NSString *name = [f[@"name"] substringFromIndex:2];
//
// // If we know which process owns the other end of the pipe/socket
// // Needs to run with root privileges for succesful lookup of the
// // endpoints of system process pipes/sockets such as syslogd
// if (devCharCodeMap[name]) {
// if ([devCharCodeMap[name] count] > 1) {
// NSLog(@"%@", [devCharCodeMap[name] description]);
// }
// NSDictionary *endPoint = devCharCodeMap[name][0];
// f[@"displayname"] = [NSString stringWithFormat:@"%@ (%@)",
// f[@"displayname"], endPoint[@"pname"]];
// f[@"endpointname"] = endPoint[@"pname"];
// f[@"endpointpid"] = endPoint[@"pid"];
// f[@"endpointimg"] = endPoint[@"pimage"];
// }
// }
for (NSMutableDictionary *f in process[@"children"]) {
if (![f[@"type"] isEqualToString:@"Unix Domain Socket"] && ![f[@"type"] isEqualToString:@"Pipe"]) {
continue;
}
// Identifiable pipes and sockets should have names in the format "->[NAME]"
if ([f[@"name"] length] < 3) {
continue;
}

NSString *name = [f[@"name"] substringFromIndex:2];

// If we know which process owns the other end of the pipe/socket
// Needs to run with root privileges for succesful lookup of the
// endpoints of system process pipes/sockets such as syslogd
if (devCharCodeMap[name]) {
NSArray *endPoints = devCharCodeMap[name];
NSMutableArray *epItems = [NSMutableArray new];
NSDictionary *first = devCharCodeMap[name][0];
f[@"displayname"] = [NSString stringWithFormat:@"%@ (%@%@)",
f[@"displayname"], first[@"pname"],
[endPoints count] > 1 ? @" ..." : @""];
for (NSDictionary *e in endPoints) {
NSString *i = [NSString stringWithFormat:@"%@ (%@)", e[@"pname"], e[@"pid"]];
[epItems addObject:i];
}
f[@"endpoints"] = epItems;
}
}
}

return processList;
Expand Down
25 changes: 17 additions & 8 deletions sparkle/SlothAppcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,26 @@
<language>en</language>

<item>
<title>Version 2.7</title>
<pubDate>Sunday, 10 Feb 2019 14:42:00 +0000</pubDate>
<enclosure url="https://sveinbjorn.org/files/software/sloth/sloth-2.7.zip" sparkle:version="182" sparkle:shortVersionString="2.7" length="644176" type="application/octet-stream" sparkle:dsaSignature="MEQCIBn7dhIv7wAUQ8DKoth3C77hGmVcrgUYFPVW7dS95Q9aAiAhVYoVGK5Z3FHs
J7Y1kWKHnZxiff/F9lVkNtLPtz8xtQ=="/>
<title>Version 2.8</title>
<pubDate>Wednesday, 27 Mar 2019 22:01:00 +0000</pubDate>
<enclosure url="https://sveinbjorn.org/files/software/sloth/sloth-2.8.zip" sparkle:version="210" sparkle:shortVersionString="2.8" length="671365" type="application/octet-stream" sparkle:dsaSignature="MEQCIAUxA3sToni4fkqzIF8dRqyNtGa9OgBv4bEq4SxW/ljeAiAELq05lFPHuZDQURftI249nvhaNSNhwVyVC+fOR9jDfw=="/>
<sparkle:minimumSystemVersion>10.8.0</sparkle:minimumSystemVersion>
<description><![CDATA[
<h2>New in Sloth 2.7</h2>
<h2>New in Sloth 2.8</h2>
<ul>
<li>Info Panel now shows file Uniform Type Identifier</li>
<li>Fixed crash bug on macOS 10.9 and earlier</li>
<li>Various minor bug fixes and interface improvements</li>
<li>Sloth is now Developer ID signed, which should silence Apple's annoying GateKeeper. You may have to fetch it manually: <a href="https://sveinbjorn.org/files/software/sloth/sloth-2.8.zip">https://sveinbjorn.org/files/software/sloth/sloth-2.8.zip</a></li>
<li>New Dark Mode friendly template icons for Mojave</li>
<li>Multiple items can now be selected and copied</li>
<li>Info Panel now shows which processes are connected to each other via unix pipes & domain sockets</li>
<li>Info Panel now also shows file system info such as device name & inode</li>
<li>Cmd-L menu action to show selected item</li>
<li>Minor performance improvements</li>
<li>Sparkle update framework now has Mojave Dark Mode-compatible appearance</li>
<li>No longer shows hidden volumes in Volumes filter</li>
<li>Fixed issue with mangled process names</li>
<li>Fixed issue with pipe icon on non-retina displays</li>
<li>Fixed minor memory leak</li>
<li>More graceful error handling when file descriptor lookup fails in lsof</li>
</ul>
]]></description>
</item>
Expand Down

0 comments on commit 91b6b74

Please sign in to comment.