5 years ago (2016-01-09)  Software development Technical application |   First to comment  86 
post score 0 times, average 0.0

Code obfuscation

What is code confusion

Java is a cross-platform, interpreted language in which Java source code is compiled into an intermediate "bytecode" stored in a class file.Due to cross-platform requirements, Java bytecode includes a lot of source code information, such as variable names, method names, and access to variables and methods through these names. These symbols carry a lot of semantic information and can be easily decompiled to Java. Source code.To prevent this, we can use the Java obfuscator to confuse Java bytecode. Obfuscation is to reorganize and process the released program, so that the processed code and the pre-processing code accomplish the same function, and the obfuscated code is difficult to be decompiled. Even if the decompilation is successful, it is difficult to obtain the true semantics of the program. .The confusing program code still complies with the original file format and instruction set. The execution result is also the same as before, but the obfuscator changes the names of all the variables, functions, and classes in the code to short English letter codes. With the corresponding function names and program comments, it will be difficult to read even if it is decompiled.At the same time, confusion is irreversible. In the process of confusion, some information that does not affect normal operation will be permanently lost. The loss of such information makes the program more difficult to understand. The role of the obfuscator is not only to protect the code, it also has the effect of streamlining the size of the compiled program.Due to the reasons for shortening variables and function names and missing part information described above, the volume of the jar file after compilation can be reduced by approximately 25%, which is of certain significance to the current more expensive wireless network transmission.


NDK packages the application's core code or communication protocol into a so file

The NDK can implement code protection. Because the apk's java layer code is easily decompiled, the C/C++ library is difficult to reverse.

Because java is a semi-interpretative semi-compiled language, the java code is interpreted as a CLASS file, then compiled into a JVM in the computer, and then the virtual machine calls the corresponding computer component to perform the operation. The Android SO file is linux. The next file, written in c or c++, can be seen as an extended version of C. C has good machine compatibility, because it can be directly compiled into machine instructions, the execution efficiency is relatively high compared to java, and java is a cross Platform migration can be planted.

C/C++ is closer to the underlying system implementation and depends on the compiler. Binary code generated by different compilers will be different from different platforms. Even different compilers of the same operating system will have a little difference, such as compiling C/C under Linux. The binary code that C++ gets is difficult or impossible to run on the Windows platform, and vice versa, so decompilation is difficult, and now most decompiler software can only be decompiled to assembly.There are some tools that can be decompiled into C or C++, but most of the results of decompilation do not understand, it is better to use assembly.



This article is synthesized from:

  • http://blog.csdn.net/z157794218/article/details/40039785, Baidu knows

This article has been printed on copyright and is protected by copyright laws. It must not be reproduced without permission.If you need to reprint, please contact the author or visit the copyright to obtain the authorization. If you feel that this article is useful to you, you can click the "Sponsoring Author" below to call the author!

Reprinted Note Source: Baiyuan's Blog>>https://wangbaiyuan.cn/en/confused-androidstudio-code-with-ndk-prevention-apk-decompiling-2.html

Post comment


No Comment


Forget password?