Monday, May 14, 2012

3 easy steps android apk Reverse Engineer to get java source-code

Android applications are packed inside a APK file, which is just a ZIP file containing among other things a compact Dalvik Executable (.dex) file.

First step is to extract the “classes.dex” file from the APK:

$ unzip program.apk classes.dex
Archive: program.apk
inflating: classes.dex

Now, we use the tool dex2jar to convert the classes.dex file to Java .class files:
$ bash dex2jar/ ./classes.dex
2 [main] INFO - dex2jar ./classes.dex -> ./classes.dex.dex2jar.jar

here bash is to execute bash script and ./classes.dex is one of your extracted apk files

here output will be dex2jar.jar

From here we obtain the file “classes.dex.dex2jar.jar”, now we can use the java decompiler JD-GUI to extract the source code:
$ ./jd-gui classes.dex.dex2jar.jar

Now just go to “File -> Save all sources” and it will generate the zip file “” containing all the decompiled Java source code 

No comments:

Post a Comment