Last active
December 6, 2023 11:18
-
-
Save mikehouse/64ff72ba1cdeb76cd5535cbe49773df8 to your computer and use it in GitHub Desktop.
Gel list of all mobileprovision in the MacOS system Xcode
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/sh -e | |
cd ~/Library/MobileDevice/Provisioning\ Profiles/ | |
echo "" | |
for file in $(ls | grep 'mobileprovision'); do | |
XML=$(security cms -D -i $file) | |
FOUND_CREATION_DATE=false | |
FOUND_PLATFORM=false | |
FOUND_PLATFORM_ARRAY=false | |
FOUND_BUNDLE_ID=false | |
PLATFORM='' | |
BUNDLE_ID='' | |
CREATION_DATE='' | |
while IFS= read -r line; do | |
if $FOUND_PLATFORM_ARRAY; then | |
PLATFORM=$(echo $line | grep -o '>.*<' | grep -o '[A-z]*') | |
FOUND_PLATFORM=false | |
FOUND_PLATFORM_ARRAY=false | |
continue | |
fi | |
if $FOUND_PLATFORM; then | |
if echo $line | grep -q '<array>'; then | |
FOUND_PLATFORM_ARRAY=true | |
continue | |
fi | |
fi | |
if echo $line | grep -q '<key>Platform</key>'; then | |
FOUND_PLATFORM=true | |
continue | |
fi | |
if echo $line | grep -q '<key>CreationDate</key>'; then | |
FOUND_CREATION_DATE=true | |
continue | |
fi | |
if $FOUND_CREATION_DATE; then | |
CREATION_DATE=$(echo $line | grep -o '>.*<' | grep -o '[^<>]*') | |
FOUND_CREATION_DATE=false | |
continue | |
fi | |
if echo $line | grep -q '<key>application-identifier</key>'; then | |
FOUND_BUNDLE_ID=true | |
continue | |
fi | |
if $FOUND_BUNDLE_ID; then | |
BUNDLE_ID=$(echo $line | grep -o '>.*<' | grep -o '[0-9A-z\.\*]*') | |
FOUND_BUNDLE_ID=false | |
break | |
fi | |
done <<< "$XML" | |
echo "${file} | ${BUNDLE_ID} | ${PLATFORM} | Created at ${CREATION_DATE}" | |
done | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment