Created
April 3, 2019 19:09
-
-
Save notsle/c25e4b8598719550c5bf682a29d5615e 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 | |
if [ -z "$1" ]; then | |
printf "Please provide an ipa file. Usage: listudids file_name.ipa [-all]\n" | |
exit | |
fi | |
if [ -n "$2" ] && [ "$2" == "-all" ]; then | |
all="all" | |
fi | |
FILE=$1 | |
if [ -f "$FILE" ]; then | |
printf "Finding udids in '%s'...\n" "$FILE" | |
IFS=$'\n' | |
alludids="" | |
for provisionFile in $( unzip -l "$FILE" | grep embedded.mobileprovision | awk '{$1=$2=$3=""; print $0}' | sed "s/^[ \t]*//" ); do | |
out=$(unzip -p $FILE $provisionFile | strings | awk '/ProvisionedDevices/,/\/array/'| grep string | sed 's/<[/]*string>//g' | sed 's/^/ /g') | |
number=$(echo "$out" |grep \[A-Za-z0-9] | wc -l |xargs) | |
alludids=$(printf "%s\n$s" $alludids $out) | |
printf "%s udids in %s \n" $number $provisionFile; | |
if [ -n "$all" ]; then | |
for udid in $out; do | |
printf " %s\n" $udid | |
done | |
fi | |
done | |
printf "Here are the udids we found:\n" | |
for udid in $alludids; do | |
printf "%s\n" $udid | |
done | sort | uniq | |
else | |
echo "The File '$FILE' Does Not Exist" | |
exit | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment