Skip to content

Instantly share code, notes, and snippets.

@sushant-hiray
Last active August 29, 2015 13:55
Show Gist options
  • Save sushant-hiray/8751686 to your computer and use it in GitHub Desktop.
Save sushant-hiray/8751686 to your computer and use it in GitHub Desktop.
Decompressing an apk file

##Decompressing an apk file

This bash script can be use to decompress an apk file. The script is made as a part of an ongoing project!

###Usage

./decompress.sh -d <path to apk file>

###Dependencies

###Note: Edit the DEXPATHvariable accordingly with the path to dex2jar folder.

Sometimes the jdgui viewer doesn't render files correctly when opened from commandline, so opening them manually works currently.

#!/bin/bash
DEXPATH="/home/sushant/Downloads/dex2jar-0.0.9.15"
JDGUI="/home/sushant/Downloads/jd-gui/jd-gui"
while getopts ":d:" opt; do
case $opt in
d)
mkdir -p $OPTARG"_FILES"
cp $OPTARG $OPTARG"_FILES"
cd $OPTARG"_FILES" ; mv $OPTARG $OPTARG".zip" ; jar xvf $OPTARG".zip" ; cd ../
$DEXPATH/d2j-dex2jar.sh -f $OPTARG"_FILES"/classes.dex ;
echo "Done decompressing!"
echo "you can view the classes-dex2jar.jar file using jdgui viewer"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
@gargsanchit31
Copy link

working for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment