Skip to content

Instantly share code, notes, and snippets.

@joeytwiddle
Last active March 7, 2023 07:19
Show Gist options
  • Save joeytwiddle/f7656ccc78d90c4e59e924897b0c3dae to your computer and use it in GitHub Desktop.
Save joeytwiddle/f7656ccc78d90c4e59e924897b0c3dae to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
cache_dir="$HOME/Library/Group Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps"
if command -v find >/dev/null && command -v mktemp >/dev/null && command -v unzip >/dev/null && command -v grep >/dev/null
then :
else
echo "This script requires the follow executables to run: find mktemp unzip grep"
exit 1
fi
cat << !!!
For this script to work, you must use Apple Configurator 2 to install the app on a phone which already has it installed.
Apple Configurator 2 will download the IPA, and this script should then detect it and extract the desired info.
The process is described here: https://stackoverflow.com/a/37951190/99777
-----------------------------------------------------------------------------
!!!
echo "Watching for IPA in: $cache_dir"
echo
while true
do
if [ ! -d "$cache_dir" ]
then
sleep 2
continue
fi
ipa_file="$(find "$cache_dir" -name '*.ipa')"
if [ -n "$ipa_file" ] && [ -f "$ipa_file" ]
then
echo "Found IPA: $ipa_file"
tmp_dir="$(mktemp -d)"
echo
echo "Unzipping it into $tmp_dir"
#echo "Unzipping it..."
cd "$tmp_dir"
unzip -q "$ipa_file"
echo
echo "Looking for schemes:"
echo
# The real one we are interested in is "CFBundleURLSchemes"
grep -i -A5 "CFBundleURL" ./Payload/*/Info.plist || true
echo
#echo "Remember to delete: $tmp_dir"
#echo
cd /
rm -rf "$tmp_dir"
break
else
sleep 2
continue
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment