snitch

i got tired of typing ss -tulpn and grepping through the output every time i wanted to check something. it's one of those things where the tool works, it does the job, but every time you use it you're doing the same few manual steps to get to what you actually wanted. at some point i just decided to write something for myself.

spent a weekend on it. TUI that shows you what's listening, what's connected, which process owns each socket. i wasn't trying to build a project, i just wanted to stop typing the same command.

posted it on github mostly to have somewhere to keep it. some people found it, starred it. someone packaged it for the AUR without me asking. then homebrew. then nix. i kept adding things because i wanted them anyway. JSON output, macOS support, themes. i added themes because i wanted catppuccin (obviously) and just kept going from there, now there's 15+.

how it works

connection data comes from /proc/net/tcp, /proc/net/tcp6, /proc/net/udp, /proc/net/udp6 on Linux and sysctl on macOS. the formats differ between platforms enough that it's worth getting the abstraction right early or you end up with platform-specific logic scattered everywhere.

mapping connections back to processes means correlating socket inodes from /proc/net/* with file descriptors in /proc/[pid]/fd/. you walk every process, check every open fd, match inode numbers. it's a lot of traversal and it adds up, so i cache the inode-to-process mappings with a short TTL.

the filtering composes predicates rather than tracking boolean flags. each filter is a function from row to bool, ANDed together. i refactored into that when adding new filter types kept requiring changes in too many places.

theming was more work than i expected. terminals disagree on things that feel like they should just be standard, and some combinations that look fine in one emulator look broken in another. i used an AI agent to fetch and write the actual theme definitions so i didn't have to hunt down hex codes from a bunch of random websites.

status

stable. homebrew, go install, nix, AUR, shell script. source on github under MIT.