Current location - Quotes Website - Signature design - How to decompile an Android application
How to decompile an Android application
Let's take a look at APK's files first. The application package of Android is a. Apk files, whether you download them from the mobile phone market or from the computer. These are all APK files. APK is the abbreviation of AndroidPackage, namely Android installation package (apk). APK is a file format similar to Symbian Sis or Sisx. It can be installed by directly transferring APK files to Android emulator or Android phone for execution. Like sis, apk files package the projects compiled by android sdk into apk format installer files. The APK file is actually in zip format, but the suffix is changed to apk. After decompression, you can see the Dex file. Dex is the full name of Dalvik VM executes, that is, Android Dalvik Executors, not Java ME bytecode, but Dalvik bytecode. When running a program, Android needs to decompress first, and then it is as direct as Symbian, which is different from PE files in Windows Mobile.

robot

When you unzip and open the APK file, you usually have a folder like this:

META-INF directory:

Manifestation MF: manifest file

Certified RSA: Application Certificate

SF: SHA- 1 resource signature list that proves qualified. For example:

Signature-Version: 1.0

Created by 1.0 (Android)

sha 1-Digest-Manifest:wxqneai 0 ua 5 no 5 QJ 8 cgmwjkgwe =

...

Name: res/layout/exchange _ component _ back _ bottom.xml.

sha 1-Digest:eacjmjesj 7 zkf 0 cbftz 0 qwrt 7 w =

...

Name: res/drawable-hdpi/icon.png.

sha 1-Digest:dgeqylp 8 w0 n 0iv/zzbx 3 MW 0 wgca =

Lib: This directory contains some specific compiled codes. This folder is divided into the following parts.

Armeabi: Compiled code based on all ARM processors only.

Armeabi-v7a: Compiled code for all ARMv7 processors.

X86: Code compiled only for x86 processors.

Mips: Code compiled for MIPS processors.

Res: The directory containing the resource is not compiled into the resource file. See the following:

Assets: Assets containing applications, which can be retrieved through AssetManager.

AndroidManifest.xml: A metadata file containing an application, describing its name, version, access rights and library files that reference the application. This file is in Android binary format and can be converted into readable plain text XML tools by tools, such as? AXMLPrinter2, apktool or Androguard. Settings, which can be retrieved through AssetManager.

Classes.dex: Dalvik bytecode

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

There are two ways to decompile APK. If it is a Chinese program, you can use apktool:

Installation process

1. Download apktool 1.5.2.tar.bz2 and apktool-install-Windows-R05-Bruce1.tar.bz2.

2. Unzip two files and put them in the same directory, * * * three files.

aapt.exe

apktool.bat

The apktool.jar is used for unpacking, and the apktool.jar and aapt.exe are used for packaging together.

Execute at the command line:

apktool d d:\xxx.apk d:\xxx

Xxx is your output directory. Then you can look at some xml resource files and Smali files. As shown below, the decompiled output directory of APK file is:

Smali and Baksmali refer to. Dex formats used by Java Virtual Machine (Dalvik) in Android system. Its grammar is a loose Jasmin/dedexer grammar, which is implemented. Dex format.

You can use dex2jar, extract it after downloading, and directly drag the apk file to dex2jar.bat file to generate the corresponding *. Jar file. At this time, open the jar file with JD-GUI, and you can see the java source code and export it.

It can be seen that decompilation of Android applications is not difficult, and the struggle between encryption and decryption will continue.