Pages

Wednesday 25 February 2015

Android App Cracking Tutorial #1


Introduction


Understanding APK

What is Apk file?

Android application package file (APK) is the file format used to distribute and install application software and middleware onto Google's Android operating system. APK files are ZIP file formatted packages based on the JAR file format with .apk file extensions

What are the Contents you find inside Apk? 

An APK file is an archive that usually contains the following directories: 
  • META-INF directory: 
  • MANIFEST.MF: The Manifest File 
  • CERT.RSA: The certificate of the application 
  • CERT.SF: The list of resources and SHA-1 digest 
Corresponding lines in the MANIFEST.MF file; for example:
----------------------------------------------------------------------
Signature-Version: 1.0
Created-By: 1.0 (Android)
SHA1-Digest-Manifest: wxqnEAI0UA5nO5QJ8CGMwjkGGWE=
Name: res/layout/exchange_component_back_bottom.xml
SHA1-Digest: eACjMjESj7Zkf0cBFTZ0nqWrt7w=
Name: res/drawable-hdpi/icon.png 
SHA1-Digest: DGEqylP8W0n0iV/ZzBx3MW0WGCA=
-----------------------------------------------------------------------

lib: the directory containing the compiled code that is specific to a software layer of a processor, the directory is split into more directories within it: -
      -armeabi: compiled code for all ARM based processors only
      -armeabi-v7a: compiled code for all ARMv7 and above based processors only
      -x86: compiled code for x86 processors only
      -mips: compiled code for MIPS processors only

classes.dex: The classes compiled in the dex file format understandable by the Dalvik virtual machine 

res: The directory containing resources not compiled into resources.arsc (see below).

assets: a directory containing applications assets, which can be retrieved by AssetManager.

AndroidManifest.xml: An additional Android manifest file, describing the name, version, access rights, referenced library files for the application. This file may be in Android binary XML that can be converted into human-readable plain text XML with tools such as AXMLPrinter2, android-apktool, or Androguard

resources.arsc: A file containing precompiled resources, such as binary XML for example.

Tools & Download

Name
Download
Apktool Mobile Ver-4.6
APK Editor Ver.1.90
Axel Ver.2.4
920 Text Editor Ver.13.7.18
aGrep Ver.2014.03
  

How to Use Tool’s

1. Apktool Mobile

What is Apk tool?
This tool is basically we use for Decompile & Recompile Apk file

How to Setup this Tool?
-  Unzip Apktool4.6_armhf.zip to your SD Card and install Apktool.apk inside
- Once installation done start app then goto directory where Apktool4.6_armhf.zip Unzipped & rename folder to “Apktool”
-  Now select that Unzipped Apktool folder and hold your finger until it pop-up following options




-   Now select “Set as apktool data folder” option
-  There are more option which you find inside setting option you can choose option which is more suitable for you
         Option which I pref:-
Ø      Vibration
Ø      Notification
Ø      Wrap output Message
Ø      File Sort Rule
Ø      Aapt - 4.4  (Android Asset Packaging Tool)
Ø      Apk tool version – 2.0

How to Use this Tool?
For this you need to know what functions it offer like-
Decompile functions
-          Decompile all (This will decompile Dex + Resources)
-          Decompile Dex (This will decompile Dex in to Smali Codes)
-          Decompile Resources (This will decompile layout  ie AXML Binary format to XML)
           
Other functions
-          Zipalign (This function align all files inside apk)
-          Sign (This will sign apk after modification)
-          Create odex
-          Add/Extract/Delete (META-INF)
-          Dex2Jar (This will convert Dex in to Java class file’s)
-          Jar2Dex (This will recompile Jar in to Dex file’s)
-          Install (This will help to install app)
-          Cancel

Recompile functions
-          Recompile (This will Re-Compile Source folder)
( Note:- Recompile function pop-up only when you click folder which end with “_src” for Eg:- apk_src  i.e application decompile folder ) 

2. APK Editor
This tool have very good features like-
-          Editing Text inside AXML file & Dex directly
-          Replace moded file with original file inside APK directly
-          Cloning APK so that you can use same application on single device
-          Optimize & Sign
We are going to use this app as resource editor for editing text strings

3. Axel
This is very good app to open AXML Binary format in to human readable format or modify  decompile XML format which we come across at the time of editing various application layout inside resource folder

4. 920 Text Editor
We use this application to edit & save our Decompile Smali Codes

5. aGrep
We use this application to find the strings in Decompile Smali Codes folder


No comments:

Post a Comment