[Android] apk reversing


Writing time : 2012-11-28 22:11:39

apk reversing

APK file extraction


Execute adb shell. Use the pm list packages -f command to search the package list and check the path of the desired APK.
The reason for giving the -f option is to print the path of the package.

#adb shell  
shell@android:/ $ pm list packages -f  
  
package:/data/app/xxx.yyy.zzzz.apk=xxx.yyy.zzzz  
  
shell@android:/ $ exit  

Exit shell mode with exit and extract apk using adb pull command.

#adb pull /data/app//xxx.yyy.zzzz.apk d:로컬경로xxx.yyy.zzzz.apk  
3451 KB/s (10932952 bytes in 3.093s)  

Extract dex files from APK


You can find the classes.dex file by extracting the extracted APK file with Alzip.

dex file to jar file


For decomple, you need to change the dex file to jar. Download dex2jar from the link below.

http://code.google.com/p/dex2jar/

Change classes.dex to classes.jar by using the command below.

#dex2jar classes.dex  
this cmd is deprecated, use the d2j-dex2jar if possible  
dex2jar version: translator-0.0.9.12  
dex2jar classes.dex -> classes_dex2jar.jar  
Done.  

After decomple the jar file classes to java, analyze the source


If you install JD-GUI from the link below and open the created jar file, you can see the java source.

https://code.google.com/p/innlab/downloads/detail?name=jd-gui-0.3.3.windows.zip&can=2&q=

files used for decomple


dex2jar.zip

jd-gui-0.3.5.windows.zip

Reference URL and documentation


PDF document

Reference URL

Previous post

Next post