Skip to content

Instantly share code, notes, and snippets.

@squio
Forked from possan/list-ipa-udid.sh
Last active February 19, 2016 08:32
Show Gist options
  • Save squio/8f6284c2039444711290 to your computer and use it in GitHub Desktop.
Save squio/8f6284c2039444711290 to your computer and use it in GitHub Desktop.
Simple script to list the allowed UDID's inside an apple IPA package, to verify it's going to work on a specific users device.
#!/bin/sh
#
# Simple script to print out UDID's in apple IPA packaged apps.
#
# Syntax: list-ipa-udid.sh {my-application.ipa}
#
IPA=$1
if [ -z "$IPA" ]
then
echo "Syntax: list-ipa-udid.sh {my-application.ipa}"
exit 1
fi
TMP=`mktemp -d -t ipadump`
XML=$TMP/xml
XML2=$TMP/xml2
# echo "Allowed UDID's in $IPA:"
# echo "* extract to $TMP ..."
mkdir -p "$TMP"
cp "${IPA}" $TMP/tmp.zip
cd $TMP
unzip -q tmp.zip
# find . | grep mobileprovision
PRO=`find . | grep embedded.mobileprovision`
# echo "check provisioning file $PRO ..."
security cms -D -i $PRO > $XML
# echo "provisioning content in $XML "
plutil -extract ProvisionedDevices xml1 -o $XML2 $XML
cat $XML2 | grep string | awk -F [\>\<] '{print $3 }' | sort
rm -rf $TMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment