Extract Android apk from Market and Decompile it to Java Source
Download .apk file from market
- Search in market for the app you want to decompile and install it on your phone.
- Install Astro File Manager from market (link). Open Astro > Tools > Application Manager/Backup and select the application to backup on to the SD card .
- Mount phone as USB drive and access
'\backups\apps\'
folder to find the apk of target app (lets call it targetapp.apk) . Copy it to your local drive.
Decomiling apk to Dex format
- Download Dex2Jar (link) (Android runs applications which are in Dalvik Executable (.dex) format).
- Run the command to convert apk to jar
dex2jar targetapp.apk file(./dex2jar targetapp.apk on terminal)
File ‘targetapp.apk.dex2jar.jar’ is created
Viewing/Decompiling the Jar files to Java
Method 1 : Use JavaDecompiler (JD)
- Open ‘targetapp.apk.dex2jar.jar’ with jd-gui (link)
- File > Save All Sources to sava the class files in jar to java files.
Method 2: JAD
- Extract contents of jar file on to a folder named src. Use and unarchival utility like 7zip
- Keep ‘src’ folder in the same directory where JAD and targetapp jar is present
- Open JAD in cmd and execute the following command
jad -o -r -sjava -dsrc src/**/*.class
(./jad on terminal)
Now src will contain decompiled Java files ready for manual code review.
Tools Used
- Sample app – RemoteDroid (Opensource – link)
- Astro File Manager (Android Market – link)
- Dex2Jar (link)
- jd-gui (link)
- JAD (link)
Dex2Jar Info | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
App Name | Dex2Jar | ||||||||||
License | free | ||||||||||
Type |
|
||||||||||
App URL | |||||||||||
More Info | link |
No comments:
Post a Comment