Experience of the android reverse APK Program

Source: Internet
Author: User

This article describes how to reverse an android APK application. The method provided in this article is only for research and learning.

 

The tools required in this article are:

JDK is used to build a Java Runtime Environment.

Axmlprinter2.jar: Used to reverse the. xml file.

Baksmali. jar is used to reverse the classex. Dex file.

 

 

 

 

 

Because the android.apk file is actually a zip file, it can be opened directly with WinRAR.

As shown in:

 

Open with RAR we can see that the file is actually a zip package contains a META-INF folder, this folder is used to save the signature file, ensure the integrity of the package

The res folder contains the resource files used by the APK. They are all stored intact. We can extract them directly and read and modify the string file directly during Chinese conversion.

 

The androidmanifest. xml file is a compiled configuration file used to declare the activity, service, and permissions contained in the program. Resources. ARSC is a compiled resource description file, and the main concern is classes. Dex. The android program we compiled, all. java files in the source program, are finally compiled into such a. Dex file and executed on the Dalvik virtual machine on the Android mobile phone.

 

First, we will introduce how to reverse a. xml file.

 

Because the XML file in the APK is directly opened in notepad, there are still some garbled characters.

So we need to restore it to better understand it.

 

Axmlprinter2.jar is required here.

 

Specifically, we use androidmanifest. XML as an example to open the command line. Enter the following command:

 

Java-jar axmlprinter2.jar androidmanifest. xml> androidmanifest.txt

 

If you are interested, you can also write a. Bat script for easy execution.

Let's look at the execution results.

 

Androidmanifest. xml file before execution

 

 

After the command is executed, let's take a look.

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <manifest <br/> xmlns: Android = "http://schemas.android.com/apk/res/android" <br/> Android: versioncode = "322" <br/> Android: versionname = "ver 3.2.2" <br/> package = "com. eoeandroid. wallpapers. christmas "<br/> <application <br/> Android: Label =" @ 7f040000 "<br/> Android: icon = "@ 7f020004" <br/> <activity <br/> Android: Label = "@ 7f040001" <br/> Android: Name = ". main "<br/> <intent-filter <br/> <action <br/> Android: Name =" android. intent. action. main "<br/> </Action> <br/> <Category <br/> Android: Name =" android. intent. category. launcher "<br/> </Category> <br/> </intent-filter> <br/> </activity> <br/> <service <br/> Android: name = ". service. syncdeviceinfosservice "<br/> </service> <br/> <meta-data <br/> Android: Name =" com. mobclix. application_id "<br/> Android: value = "30c0e2bb-a878-43cb-830b-a39fcae33b0c" <br/> </meta-data> <br/> </Application> <br/> <uses-SDK <br/> android: minsdkversion = "3" <br/> </uses-SDK> <br/> <uses-Permission <br/> Android: Name = "android. permission. internet "<br/> </uses-Permission> <br/> <uses-Permission <br/> Android: Name =" android. permission. set_wallpaper "<br/> </uses-Permission> <br/> <uses-Permission <br/> Android: Name =" android. permission. write_external_storage "<br/> </uses-Permission> <br/> <uses-Permission <br/> Android: Name =" android. permission. access_network_state "<br/> </uses-Permission> <br/> <uses-Permission <br/> Android: Name =" android. permission. read_phone_state "<br/> </uses-Permission> <br/> <uses-Permission <br/> Android: Name =" android. permission. access_network_state "<br/> </uses-Permission> <br/> </manifest> <br/> 

Basically the same as the source program

Here I take an EOE wallpaper program as an example.

 

 

 

Next, you must be more concerned about the inverse of classes. Dex.

 

This is actually very similar to the previous one.

Using the baksmali. Jar tool, a foreign expert on Android has done a lot of research.

 

Execute Code

Java-jar baksmali. jar-O classout/classes. Dex

 

Classes. Dex can be reversed into a folder

Here I can take a picture to show you.

 

 

Open one of the files. Let's continue.

 

 

Do you think this code is very friendly?

From this code, we can roughly infer some structure processes of the source program.

Learn from this

 

 

This article is only for research and learning.

Welcome to discuss with me

 

 

The address of this article is as follows. Please enter this sentence

Http://blog.csdn.net/Zengyangtech/archive/2010/08/12/5807517.aspx

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.