Skip to content

Instantly share code, notes, and snippets.

@tito
Last active March 7, 2017 16:20
Show Gist options
  • Save tito/5dd87320dd4057095dc8f844725c8afc to your computer and use it in GitHub Desktop.
Save tito/5dd87320dd4057095dc8f844725c8afc to your computer and use it in GitHub Desktop.
Unpack Kivy APK

This is a script that you can use to check the content of a Kivy-based APK. It will automatically create a temporary directory, unpack everything, show you the files inside, and drop a shell for more inspection.

chmod +x unpackapk
./unpackapk PATHTOAPK.apk

Or if you just want the file listing:

./unpackapk PATHTOAPK.apk -l
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: unpackapk PACKAGE.APK"
fi
LIST_ONLY=0
if [ "X$2" == "X-l" ]; then
LIST_ONLY=1
fi
TEMPDIR=__$(basename $1 .apk)
if [ -d $TEMPDIR ]; then
rm -rf $TEMPDIR
fi
mkdir $TEMPDIR
unzip $1 -d $TEMPDIR
cd $TEMPDIR
cd assets
mv private.mp3 private.tar
tar xf private.tar --no-same-owner
find . -type d -exec chmod +x {} \;
rm private.tar
cd ..
find .
if [ $LIST_ONLY -eq 0 ]; then
echo ""
echo "You are inspecting" $(basename $1)
echo "Type ^D to leave the inspection"
echo ""
bash
echo "Leaving inspection..."
fi
cd ..
rm -rf $TEMPDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment