Skip to content

Instantly share code, notes, and snippets.

@joanbono
Created March 10, 2020 13:02
Show Gist options
  • Save joanbono/fd23d54aa6871d2b60f74a570dd17957 to your computer and use it in GitHub Desktop.
Save joanbono/fd23d54aa6871d2b60f74a570dd17957 to your computer and use it in GitHub Desktop.
extract-ipa.sh
#!/bin/bash
# From: https://medium.com/@naphonjaipaeng/extract-ipa-from-jailbroken-ios-11-device-478f6cca567d
if [ ! -z "$1" -a "$1" != " " ]
then
EXTRACT_APP_PATH=$1
# echo $EXTRACT_APP_PATH
if [ -d "$EXTRACT_APP_PATH" ]
then
EXTRACT_APP_NAME="$(ls $1/ | grep .app)"
# echo $EXTRACT_APP_NAME
if [ ! -z "$EXTRACT_APP_NAME" -a "$EXTRACT_APP_NAME" != " " ]
then
echo "Found application bundle : $EXTRACT_APP_NAME"
EXTRACT_DIR=${EXTRACT_APP_NAME::-4}
# echo $EXTRACT_DIR
if [ -d "$EXTRACT_DIR" ]; then
rm -rf $EXTRACT_DIR
fi
echo "- Create a working directory"
mkdir $EXTRACT_DIR
mkdir $EXTRACT_DIR/Payload
echo "- Copy application bundle to a working directory"
cp -R $EXTRACT_APP_PATH/$EXTRACT_APP_NAME $EXTRACT_DIR/Payload
cd $EXTRACT_DIR
echo "- Build an IPA file"
zip -rq $EXTRACT_APP_NAME.ipa Payload
cd ..
mv $EXTRACT_DIR/$EXTRACT_APP_NAME.ipa .
echo "- Remove the working directory"
rm -rf $EXTRACT_DIR
echo "Done."
echo ""
echo "IPA: $EXTRACT_APP_NAME.ipa"
echo ""
else
echo "Error: application .app directory DOES NOT exists."
fi
else
echo "Error: application bundle directory DOES NOT exists."
fi
else
echo "Usage: ./extract-ipa.sh /path/of/bundle"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment