Skip to content

Instantly share code, notes, and snippets.

@levantAJ
Created August 7, 2019 03:20
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save levantAJ/be52cc86dc5d476f23e4be75ae7905cc to your computer and use it in GitHub Desktop.
Save levantAJ/be52cc86dc5d476f23e4be75ae7905cc to your computer and use it in GitHub Desktop.
Extract *.ipa file to looking for all scheme URLs
#!/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
@levantAJ
Copy link
Author

levantAJ commented Aug 7, 2019

How to use:

  • Download this script
  • Open terminal: bash extract-scheme-url.sh YourAppName.ipa

@itsbrex
Copy link

itsbrex commented Jan 17, 2022

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.

@levantAJ
Copy link
Author

Is there any app as an example that I can take a look?

@specialops-alex
Copy link

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