Last active
April 21, 2025 17:42
-
-
Save und3fined/a9c8128ce32204c4390ff6462b3e4015 to your computer and use it in GitHub Desktop.
Extract IPA from Apple Configurator tools
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/zsh | |
# Save content as extract-ipa.sh file name | |
# chmod +x extract-ipa.sh | |
# Open terminal and run ./extract-ipa.sh <app id> | |
# App ID is Id in appstore url. Like https://apps.apple.com/cn/app/ai-app/id6447539504?l=en&uo=4 | |
# App ID -> id6447539504 | |
# Full command like: ./extract-ipa.sh id6447539504 | |
WATCHED_DIR="$HOME/Library/Group Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps" | |
OUTPUT_DIR="$HOME/Downloads/ipa" | |
APP_ID=$1 | |
FOLDER_ID=${APP_ID:2} | |
WATCH_STATUS=0 | |
# Color list | |
RED="\033[31m" | |
GREEN="\033[32m" | |
YELLOW="\033[33m" | |
CYAN="\033[36m" | |
BLUE="\033[34m" | |
ORANGE="\033[35m" | |
OFF="\033[0m" | |
TXT_INFO=" ${BLUE}[i]${OFF}" | |
TXT_ERROR=" ${RED}[x]${OFF}" | |
TXT_SUCCESS=" ${GREEN}[✔]${OFF}" | |
if [ -z "$APP_ID" ]; then | |
echo -e "${TXT_ERROR} ${RED}Error${OFF}: Missing App ID" | |
echo -e "${TXT_INFO} Usage: $0 <APP_ID>" | |
exit 1 | |
fi | |
# While true for infinite loop to watch the directory | |
while true; do | |
# Check if the directory exists | |
if [ -d "$WATCHED_DIR" ]; then | |
IPA_PATH=$(find $WATCHED_DIR -wholename "*/${FOLDER_ID}" | head -1) | |
# check IPA_PATH not empty | |
if [ -n "$IPA_PATH" ]; then | |
IPA_FILE=$(find $IPA_PATH -name "*.ipa" | head -1) | |
IPA_NAME_NAME=$(basename $IPA_FILE) | |
# create output directory if not exists | |
mkdir -p $OUTPUT_DIR | |
# copy IPA file | |
echo -e "${TXT_INFO} IPA file found: ${GREEN}${IPA_NAME_NAME}${OFF}. Copying to ${YELLOW}${OUTPUT_DIR}/${APP_ID}.ipa${OFF}" | |
cp -f "${IPA_FILE}" "${OUTPUT_DIR}/${APP_ID}.ipa" | |
result=$? | |
if [ $result -ne 0 ]; then | |
echo -e "${TXT_ERROR} ${RED}Error${OFF} copying IPA file" | |
exit 1 | |
fi | |
echo -e "${TXT_SUCCESS} ${BLUE}Success${OFF} copying IPA file. Exiting..." | |
exit 0 | |
fi | |
fi | |
if [ $WATCH_STATUS -eq 0 ]; then | |
echo -e "${TXT_INFO} Watching for IPA file ${CYAN}${APP_ID}${OFF}..." | |
echo -e "${TXT_INFO} Use ${ORANGE}Ctrl+C${OFF} to exit" | |
WATCH_STATUS=1 | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment