Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Extract source code from an Android apk file

A simple step by step tutorial with amazing visuals on how to reverse engineer an Android apk file. Leave your comments below if any. thanks -biwin

  • Sé el primero en comentar

Extract source code from an Android apk file

  1. 1. #AndroidHacks Extract Soucre Code from an Android APK file © CambakLabs
  2. 2. Biwin John | @xkaterboi
  3. 3. disclaimer This presentation is intented only for educational puropose . Any actions and/or activities related to the information contained in the presentation is solely your responsiblity. The misuse of the information in this presentation/file may result in criminal charges brought against the person in question. THE AUTHOR AND ANY AUTHORITY(IES) RELATED WITH THIS PRESENTATION WILL NOT HOLD ANY RESPONSIBILITY IN ANYCASE FOR YOUR ACTIONS. Do not encourage to use this information to hack/crack any applications.
  4. 4. inspiration “ ” THE HARD DRIVE ON MY LAPTOP JUST CRASHED AND I LOST ALL THE SOURCE CODE FOR AN APP THAT I HAVE BEEN WORKING ON FOR THE PAST TWO MONTHS (I KNOW I AM AN IDIOT FOR NOT BACKING IT UP) ALL I HAVE IS THE APK FILE THAT IS STORED IN MY EMAIL FROM WHEN I SENT IT TO A FRIEND. MY QUESTION IS: IS THERE ANY WAY TO EXTRACT MY SOURCE CODE FROM THIS APK FILE? I REALIZE THAT IS IS MOST LIKELY A SHOT IN THE DARK... BUT I AM REALLY DESPERATE. asked on stackoverflow.com by Frank Bozzo, © 2013 Stack Exchange Inc
  5. 5. What We’re gonna do now? > Extract the Source code and resources from an android application package (.apk) file.
  6. 6. The tool kit > a valid apk file > dex2jar ¹ > java decompiler ² > apktool ³ > apktool installer 4 ¹ http://code.google.com/p/dex2jar/downloads/detail?name=dex2jar-0.0.9.9.zip ² http://www.4shared.com/zip/MIIaULpa/jd-gui-033windows.html ³ http://code.google.com/p/android-apktool/downloads/detail?name=apktool-install-windows-r04-brut1.tar.bz2 4 http://code.google.com/p/android-apktool/downloads/detail?name=apktool1.4.1.tar.bz2&can=2&q=
  7. 7. lets get started
  8. 8. Step 1 Download all the files in the toolkit and the desired apk, move them to a directory.
  9. 9. Step 2 Rename the desired apk to zip. eg: myapp.apk to myapp.zip
  10. 10. so here’s how to show the filetypes in windows 7
  11. 11. Step 3 Extract myapp.zip to a new folder. use archiving apps like 7zip, WinRAR etc.
  12. 12. Step 4 after the extraction, rename myapp.zip back to myapp.apk.
  13. 13. Step 5 Extract all the downloaded files to the same directory.
  14. 14. Step 6 move all the extracted files to the myapp directory.
  15. 15. Step 7 now our playground, myapp dir must look something like this.
  16. 16. the application files are extracted now but they are hexcodes, just machine readable, manifest.xml just reads like this.
  17. 17. Step 8 Open the windows command prompt. WinKey + R type ‘cmd’ inside the dialogue box, press Enter.
  18. 18. Step 9 Navigate cmd to the folder that you are working on. ‘cd’ <dir name> changes directory ‘cd ..’ navigate to the top level (back) ‘dir /w’ list the files by just names here I’ve used cd downloadstestmyapp as my ‘myapp’ folder inside the directory named ‘test’ inside the ‘downloads’ dir.
  19. 19. Step 10 type the command "dex2jar classes.dex" and press enter. This will generate "classes.dex.dex2jar" file in the same folder.
  20. 20. Step 11 double click to open the java decompiler (jd-gui.exe) shows the file ‘jd-gui.exe’ and the ‘classes_dex.jar.jar’ created by the previouscommand
  21. 21. Step 12 Open the jar file, browse for ‘classes_dex.jar.jar’ click open.
  22. 22. Step 13 Select save all sources, make a folder ‘sources’ in myapp then click save. Extract the Zip file in sources to get souce files
  23. 23. A Java class Just Extracted New Born:
  24. 24. Step 14 Now lets extract the xml files on the command line type ‘apktool if framework-res.apk’ press enter. //this should result in ‘Framework installed’
  25. 25. Step 15 on the command prompt type ‘apktool d myapp.apk’ (where myapp should be replaced with the apk name).
  26. 26. This creates a folder named myapp inside our working folder which contains all the xml files of the app.
  27. 27. the manifest.xml file just generated. Decoded:
  28. 28. okay now we are almost done, move the folder ‘sources’ to the folder myapp
  29. 29. HAVE FUN WITH ANDROID. RESCPECT OTHER DEVELOPERS
  30. 30. Questions? Twitter: @xkaterboi
  31. 31. thanks for watching!
  32. 32. @xkaterboi©CambakLabs Biwin John

×