Skip to content

Instantly share code, notes, and snippets.

@kibotu
Last active February 3, 2020 00:00
Show Gist options
  • Save kibotu/45deb8c087d1b10fedc2bba38293751f to your computer and use it in GitHub Desktop.
Save kibotu/45deb8c087d1b10fedc2bba38293751f to your computer and use it in GitHub Desktop.
Download APK from Device

// http://stackoverflow.com/questions/1249973/decompiling-dex-into-java-sourcecode/4177581#4177581

  1. brew install apktool

    apktool -d app.apk

  2. dex2jar, which is made by a Chinese student. It will translate dex files to jar files

    brew install dex2jar

  3. jd-gui to view the java files in the jar or use Intellij Plugin

  4. [deobfuscation]https://github.com/java-deobfuscator/deobfuscator

    java -jar deobfuscator.jar -input input.jar -output output.jar -transformer general.SyntheticBridgeTransformer -path path/to/rt.jar

The source code is quite readable as dex2jar makes some optimizations.

Procedure:

And here's the procedure on how to decompile:

Step 1:

Convert classes.dex in test_apk-debug.apk to test_apk-debug_dex2jar.jar

d2j-dex2jar.sh -f -o output_jar.jar apk_to_decompile.apk

Note: In the Windows machines all the .sh scripts are replaced by .bat scripts dex2jar documentation

Step 2:

Open the jar in JD-GUI

[![https://i.stack.imgur.com/PWJIX.png]]

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