> The script parses macOS’s system_profiler SPUSBHostDataType2 command, which produces a dense, hard-to-scan raw output
I couldn’t find source (the link in the article points to a GitHub repo of a user’s home directory. I hope for them it doesn’t contain secrets), but on my system, system_profiler -json produces json output. From that text, it doesn’t seem they used that.
internally uses the same root command btw. in fact this recently changed for Tahoe (as the article mentions).
started out as a shell script but switched to a go binary (which is what is linked).
Correct. But you didn't see that the source was one level up in the directory tree from the untrustworthy binary blob?
* https://github.com/kaushikgopal/dotfiles/blob/master/bin/usb...
Presumably there is a sensible way to do this in go by calling an API and getting the original machine-readable data rather than shelling out to run an entire sub-process for a command-line command and parsing its human-readable (even JSON) output. Especially as it turns out that the command-line command itself runs another command-line command in its turn. StackExchange hints at looking to see what API the reporter tool under /System/Library/SystemProfiler actually queries.
Last bash source: https://github.com/kaushikgopal/dotfiles/blob/7f37454a887989...
First Go source: https://github.com/kaushikgopal/dotfiles/blob/f0f158398b5e4d...