Android decompilation tool, jadx of advanced techniques

I. Introduction

Today introduced a very useful tool decompilation jadx. jadx function is very powerful, for me, basically meet the daily needs of decompilation.

jadx advantages:

  1. Graphical interface.
  2. Drag and drop operation.
  3. Decompile Java output code.
  4. Export Gradle project.

These advantages have become the first choice I make jadx decompilation, decompile it can handle most of the demand, basically I decompilation tool of choice.

Next we take a look at, jadx how to use it.

Second, the use jadx

2.1 Installation jadx

jadx itself is an open source project, the source code has been open sourced on Github.

Jadx Github :

https://github.com/skylot/jadx

Interested can directly clone the source code and then compile their own local. But in most cases, we need a compiled version. Compiled version, can be downloaded on sourceforge.

sourceforge download jadx.

https://sourceforge.net/projects/jadx/files/

Download the latest version of it, the latest version now is jadx-0.6.1. Once downloaded extract the good, you will get such a directory structure:

jadx-path

For Mac or Linux, using jadx-gui, under Windows you need to use jadx-gui.bat, and double-click to run directly, if there is a security warning, ignored it. (Hereinafter mainly to explain the Mac environment, most of the operations under Windows are similar)

2.2 jadx

As mentioned earlier, double-click jadx-gui can run directly. After running, will start a terminal, where you can see all your output operations, the error log will be output here.

After opening, you can choose a apk, dex, jar, zip, class, aar file, you can see jadx supported formats or with a lot of, basically compiled into Java bytecode virtual machine is aware, it can be decompile. In addition to selecting a file, it can also directly to the apk file, drag and drop into it, it is very easy to use.

I can find a Apk a hand, lost in, and see the effect after decompilation.

jadx-run

There is the decompiled code, for apk, some xml resources, and also a reduction decompiled back, very convenient.

Three, jadx advantages

jadx use very convenient, and the program provides gui, also good to use. Here are some useful tips to start jadx-gui program.

3.1 Powerful search

jadx provide search function is very powerful, but search speed is not slow.

You can click Navigation -> Text Search or Navigation -> Class Search activate it, or more convenient shortcut keys, shortcut keys I of this machine is control + shift + fthat this will be personal.

text-search

jadx search supports four dimensions, Class, Method, Field, Code, we can check, maximum range is based on the contents of our Code search is basically the text that match the search. Here decompiled Apk integrated Alipay, they are able to search the content alipay.

3.2 Direct search code references

Sometimes to find the key to the code, call or would like to see the areas in which it cites.

jadx also provided support in this area, we need to find a class or method to view, select the right click, select Find Usage.

find-Usage

After that, it will help you search out, in this project, which includes references to it.

usage-search

Click on it to jump directly past, very convenient.

3.3 deobfuscation

General Apk before the release went out, all will be confused, which is basically a standard domestic App. Such a class will eventually be confused with abc, the method will become abca (), this fact is not conducive to us to read. It is difficult to see a a.java file, to determine which one it is, you also need to distinguish according to the package name.

And deobfusation function, it may be for them a special name, so it is in this project, the name of the sole, to help us identify and search.

This feature can Tools - activation> deobfusation in.

Then take a look at its effects.

deo-before

After opening deobfusation effect as follows:

deo-after

You can see, a becomes p003a. I do not know think of you feel convenient to do?

3.4 a key export Gradle project

Although, jadx-gui can read the code directly, very convenient. But, after all, did not help us common to the editor. And just jadx also supports the project will decompile, directly exported into a Gradle compiled project.

By File - to activate this function> Save as gradle project.

save-gradle

The final output directory, and can be opened directly by the Android Studio.

gradle-project

But while AS can open it directly, but in most cases you are not compiled together. But this function is mainly to help AS powerful IDE features such as jump method, reference search, and so, let us read it more convenient.

Four, jadx error handling

jadx in the course, there will be some error conditions, here is a summary of some of the more common mistakes.

4.1 inconsistent code

Sometimes there are code decompilation is incomplete, you will see JADX WARNING: inconsistent code flag error.

incon-before

This piece of code, it has not Java code, is not conducive to our reading. The jadx order to cope with such a situation, you can try to open the Show inconsistent code switch. You can File - find it> Preferences in.

show-pre

After the open inconsistent code, let us look at the code, I felt kind.

code2

Code such treatment, most of the pseudo-code, there may be the wrong place, analyze specific issues it.

Preferences, there are many switches, are interested can try to find out on their own.

4.2 decompile or error Caton

jadx decompile some small Apk, no pressure at all, but for some heavier Apk, Apk generally larger than 50MB, you may encounter problems when using jadx decompile stuck.

If you look at the output terminal of the Log, you should be able to find, in fact, it is because OOM caused.

uncle

Official for issues such as lack of memory caused, but also provide some solutions.

1, to reduce the number of processing threads.

jadx order to speed up the compilation of efficiency, the use of multi-threading, and multiple threads will consume with more memory. So reducing the number of threads decompile time, it is an effective method.

If you use the command line, you can use the -j 1parameters to configure the number of threads to 1, not configured, the default number of threads is four.

The use jadx-gui, you can in the Preferences to configure the number of threads by configuring the Processing threads count.

2, modify the script jadx

Jadx directly edit the script under ./bin directory, configuration found DEFAULT_JVM_OPTS, set it to DEFAULT_JVM_OPTS="-Xmx2500M", you can configure the size of memory currently in use.

If it is a Windows system, you need to edit the file jadx.bat.

3, use the command line command

If the above methods are not easy to use, in the absence of a better way, you can directly use the command line, be put compiled by jadx command. And the number of threads configured to 1, so the slower though, but in most cases, can be normal output decompiled code.

for example:

jadx -d out -j 1 classes.dex

More over command, you can jadx -hview command.

jadx-help

A closer look at the configuration parameters jadx command, basically all OK in the Preferences, find the corresponding configuration items, cross-referencing understand it, you should find that it is used.

V. Summary

jadx indeed very easy to use, here basically put it to use, it is explained clearly.

You decompilation process, using jadx have not encountered any problems? What better recommendation tool that can give me a message in the comments section, we discuss it.

In today Cheng Hong ink film background public number, reply to " grow ." I will send you some of my sort of learning materials, include: Android decompile, algorithms, design patterns, kotlin, virtual machines, Linux, Web project source code.

Sixth, the original address


Author: Cheng Hong ink shadow
link: https: //www.jianshu.com/p/e5b021df2170
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.

 

Published 100 original articles · won praise 175 · views 540 000 +

Guess you like

Origin blog.csdn.net/f2006116/article/details/94017416