Created
November 28, 2021 18:14
-
-
Save macmule/d6f49a5eeae90792a9d7f1422bcec3e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
#################################################################################################### | |
# | |
# License: https://macmule.com/license/ | |
# | |
#################################################################################################### | |
# List all Applications in /Applications | |
applicationsList="$(ls -d /Applications/*.app)" | |
# For each app in Applications... | |
for app in $applicationsList; | |
do | |
# Check to see if the .app bundle has a receipt | |
if [ -f "$app"/Contents/_MASReceipt/receipt ]; | |
then | |
# Return App Store Certificate expiration | |
firstCertExpiry=$(openssl pkcs7 -inform der -in "$app"/Contents/_MASReceipt/receipt -print_certs -text | awk -F ' : ' '/Not After :/ { print $2; exit }') | |
# Add the above to an array | |
appArray+=("$app" : "$firstCertExpiry" "\n") | |
fi | |
done | |
# Echo out for Extension Attribute | |
echo -e "<result>${appArray[*]}</result>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment