Friday, 11 October 2013

Get source code from apk file

What is .apk file?
 APK file is nothing but Android Package File(APK). APK is the file format used to distribute and install application software and middleware on Google's Android operating system.


Apk Files are Zip file formatted packages based on the JAR file format, with .apk extension. Apk files contains all program resources and code i.e it contains .dex files, resources, assets, certificates, and manifest file.



How to get source (java files) from .apk file?

As we now know that apk file is just a zip file containing all program resource file, we can now get java code from apk files with ease. Following are steps to get java code from apk files.
Step 1:Renaming .apk file
  • Rename the .apk file with the extension .zip (for example let the file be "demofile.apk" then after renaming it becomes "demofile.apk.zip")

Step 2:Getting java files from apk

  • Now extract the renamed zip file in specific folder, for example let that folder be "demofolder".
  • Now Download dex2jar from the link for windows and extract that zip file in folder "demofolder".
  • Now open command prompt and go to the folder created in previous step and type the command "dex2jar classes.dex" and press enter.This will generate "classes.dex.dex2jar" file in the same folder.
  • Now  Download java decompiler from the link and extract it and start(double click) jd-gui.exe
  • From jd-gui window browse the generated "classes.dex.dex2jar" file in demofolder, this will give all the class files by src name.
  • Now from the File menu select "save all sources" this will generate a zip file named "classes_dex2jar.src.zip" consisting of all packages and java files.
  • Extract that zip file (classes_dex2jar.src.zip) and you will get all java files of the application.
Above steps will generate java files but to get xml files perform following steps.

Step 3:Getting xml files from apk

  • Download apktool and apktool install from the link and extract both files and place it in the same folder (for example "demoxmlfolder").
  • Place the .apk file in same folder (i.e demoxmlfolder)
  • Now open command prompt and goto  the directory where apktool is stored (here "demoxmlfolder") and type the command "apktool if framework-res.apk" 
  • Above command should result in "Framework installed ..."
  • Now in command prompt type the command "apktool d filename.apk" (where filename is name of apk file)
  • This will generate a folder of name filename in current directory (here demoxmlfolder) where all xml files would be stored in res\layout folder.

Related Posts:

  • How to find admin pages Today im gonna show how to find admin panels when you have info to login.There's a few options to find it.1) Adding to URLhttp://www.site.com/adminhttp://www.site.com/administratorhttp://www.site.com/admin.phphttp://www.site… Read More
  • XSS XSS[Behind the mask] What is XSS? Cross-site scripting (XSS) is a type of computer security vulnerability typically found in Web applications that enables attackers to inject client-side script into Web pages viewed by oth… Read More
  • ads free youtube Disable Ads on YouTube With This Simple Command There are a lot of ways to block ads, but with a simple command in the developer console, you can disable all ads on YouTube via an experiment. Google frequently … Read More
  • Syslogger [Free] What’s a keylogger ? Keylogger is a program which you will send to your victim and once he/she opens it.It will record all the keystrokes  (i.e what he/she types on keyboard) and then it will send those keystrokes to… Read More
  • The Ultimate Installation Guide for Kali Linux The Ultimate Installation Guide for Kali Linux Introducing Kali Linux The creators of BackTrack have released a new, advanced penetration testing Linux distribution named Kali Linux. BackTrack 5 wa… Read More

0 comments:

Post a Comment