Last active
July 12, 2019 15:28
-
-
Save rtrouton/d70170eb5cfc5410041931bff412c11d to your computer and use it in GitHub Desktop.
Script to get info on latest installed Gatekeeper, MRT and XProtect updates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VersionAndInstallDate(){ | |
identify_latest_update=$(printf "%s\n" $(pkgutil --pkgs=".*"$package_type".*") | sort -k1 | tail -1) | |
version_info=$(pkgutil --pkg-info-plist "$identify_latest_update" | plutil -extract pkg-version xml1 - -o - | xmllint --xpath 'string(//plist/string)' -) | |
# Read install date and translate it into human-readable output | |
install_date_info=$(/bin/date -r $(pkgutil --pkg-info-plist "$identify_latest_update" | plutil -extract install-time xml1 - -o - | xmllint --xpath 'string(//plist/integer)' - ) '+%m-%d-%Y') | |
echo "$package_type version: $version_info" | |
echo "$package_type installation date: $install_date_info" | |
echo "$package_type package receipt identifier: $identify_latest_update" | |
} | |
package_type="Gatekeeper" | |
VersionAndInstallDate | |
echo "" | |
package_type="MRT" | |
VersionAndInstallDate | |
echo "" | |
package_type="XProtect" | |
VersionAndInstallDate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing this. Works great on Mojave, but on High Sierra 10.13.6 17G7204 I got the following error:
`Gatekeeper version: 171.1.1562026697
Gatekeeper installation date: 07-08-2019
Gatekeeper package receipt identifier: com.apple.pkg.GatekeeperConfigData.16U1817
MRT version: 1.42.1.1559870917
MRT installation date: 06-26-2019
MRT package receipt identifier: com.apple.pkg.MRTConfigData.16U4054
No receipt for '' found at '/'.
-:2: parser error : Premature end of data in tag stdin line 1
^
No receipt for '' found at '/'.
-:2: parser error : Premature end of data in tag stdin line 1
^
usage: date [-jnRu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
XProtect version:
XProtect installation date:
XProtect package receipt identifier: `