Skip to content

Instantly share code, notes, and snippets.

@Geczy
Created June 17, 2023 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Geczy/1dcc73958a53ba53515096247c6b00cc to your computer and use it in GitHub Desktop.
Save Geczy/1dcc73958a53ba53515096247c6b00cc to your computer and use it in GitHub Desktop.
template to install and decrypt
Load environment variables from .env file if it exists.
Set the appropriate ipatool based on the operating system.
Make a function get_app_info_by_id(appId) to retrieve app information.
Create 'downloads' and 'decrypted' directories.
Authenticate with itunes using ipatool and provided credentials.
Set the app URL and extract the appId.
Get the bundleId using the get_app_info_by_id function.
Check if any files with the bundleId exist in the 'downloads' directory.
If files exist:
Print "Files with bundleId found. Continuing to install."
Else:
Print "No files with bundleId found."
Download the app using ipatool.
Get the most recent file from the 'downloads' directory.
If a file exists:
Print "Most recent file: <file>"
Else:
Print "Error. No files found in ./downloads directory."
Exit with an error code.
Set the current working directory and absolute path to the most recent file.
Check if the bundleId is already installed using ideviceinstaller.
If installed:
Print "Bundle ID <bundleId> found."
Else:
Print "Bundle ID <bundleId> not found. Installing."
Install the app using ideviceinstaller.
Check if the required SSH_USERNAME and SSH_PASSWORD environment variables are set.
If not set:
Print "Error: SSH_USERNAME or SSH_PASSWORD is not set."
Exit with an error code.
Decrypt the app using yarn bagbak with the bundleId and output path.
If the decryption is successful:
Uninstall the app using ideviceinstaller.
Remove the downloaded file.
Print "Successfully decrypted <bundleId>."
Else:
Print "Error decrypting <bundleId>."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment