Posted on 09-02-2022 07:18 AM
Hello Everyone,
Does anyone have a method of using an extension attribute to get a list of all casks and formulae installed in our environment?
Posted on 09-02-2022 10:44 AM
I am using an EA to pseudo-track this. It's not perfect, but it meets what our InfoSec team wants to know.
#!/bin/sh
loggedInUser=$(stat -f %Su /dev/console)
arch=$(/usr/bin/arch)
brewPath=""
if [ "$arch" == "arm64" ]; then
brewPath="/opt/homebrew/bin/brew"
else
brewPath="/usr/local/bin/brew"
fi
if [ -e "${brewPath}" ]
then
brewed=$(sudo -u "${loggedInUser}" "${brewPath}" list)
else
brewed="Nothing Installed"
fi
echo "<result>$brewed</result>"
exit 0