Created
August 7, 2019 03:20
-
-
Save levantAJ/be52cc86dc5d476f23e4be75ae7905cc to your computer and use it in GitHub Desktop.
Extract *.ipa file to looking for all scheme URLs
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/sh | |
RESET=`tput sgr0` | |
RED=`tput setaf 1` | |
GREEN=`tput setaf 2` | |
if [ "$1" ]; then | |
if ! [ -e "$1" ] | |
then | |
echo "⛔️️️️️️️️⛔️⛔️ ${RED}$1 does not exist!" | |
exit | |
fi | |
echo "${RESET}Unzipping..." | |
if ! [ -e "$1.zip" ] | |
then | |
mv "$1" "$1.zip" | |
fi | |
mkdir "extractSchemeURLTemp" | |
unzip "$1.zip" -d "extractSchemeURLTemp" &>/dev/null | |
echo "✅ URL Schemes:" | |
echo "${GREEN}" | |
files=(extractSchemeURLTemp/Payload/*.app) | |
APP_PATH=${files[0]} | |
echo "cat /plist/dict/key[text()='CFBundleURLTypes']/following-sibling::array/dict/array/string/text()" | xmllint --shell ${APP_PATH}/Info.plist | sed '/^\/ >/d' | sed 's/<[^>]*.//g' | |
mv "$1.zip" "$1" | |
rm -rf "extractSchemeURLTemp" | |
else | |
echo "${GREEN}⚙️ Installed extractSchemeURL!" | |
fi | |
if [ -e scripts/extract-scheme-url.sh ] | |
then | |
cp scripts/extract-scheme-url.sh ~/.extract-scheme-url.sh | |
else | |
if [ -e extract-scheme-url.sh ] | |
then | |
cp extract-scheme-url.sh ~/.extract-scheme-url.sh | |
fi | |
fi | |
if [ -e ~/.bashrc ] | |
then | |
string=$(<~/.bashrc) | |
if ! [[ $string == *"alias extractSchemeURL=\"bash ~/.extract-scheme-url.sh\""* ]]; then | |
echo "Setting extractSchemeURL..." | |
echo "alias extractSchemeURL=\"bash ~/.extract-scheme-url.sh\"" >> ~/.bashrc | |
cat ~/.bashrc | |
fi | |
else | |
echo "Setting extractSchemeURL..." | |
echo "alias extractSchemeURL=\"bash ~/.extract-scheme-url.sh\"" > ~/.bashrc | |
cat ~/.bashrc | |
fi | |
source ~/.bashrc |
Thanks for this. 🙏
Quick questions - any way to figure out all the available routes? I know there is LSApplicationQueries
to look at, but I've got a situation where I know several routes that work, but are not defined or listed in info.plist
.
Have been banging my head over this for a few days with no luck.
Is there any app as an example that I can take a look?
Great work on the shell script, AJ. Very useful & applicable in my own use case. Exactly what I was looking for!!!
My Unix shell skills have been degrading a bit lately, so it's refreshing to see such neatly organized if/then conditional blocks, that obviously serve essential testing functions in the execution logic of the script as well.
Thank you brother ✌️😎👍💪👌
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use:
bash extract-scheme-url.sh YourAppName.ipa