About Java Packers and code obfuscation

Source: Internet
Author: User

About Java Packers and code obfuscation

In c, code encryption, the first shell method. The so-called shell, that is, the program code is encrypted, and then with a specific program loader, the code is decrypted and loaded into memory, so that the code can avoid the anti-compilation, of course, there are packers, there are shell things, although not 100% to avoid crack, but still give the code to add a layer of strong maintenance.

In Java, however, maintaining code is a difficult task, because the class file is very standard, easy to decompile, and the anti-compiled code is clearly readable. A common maintenance approach is to use code obfuscation to disrupt the name of class and function and the variable, and to disturb the readability of the anti-compiled code. Although the security of the code is improved briefly, it is only appropriate for Shell-free C programs.

is Java able to shell? Once I thought this was not possible, due to the dynamic loading code such a memory level of operation, Java can not do, unless the use of JNI (Javanativeinterface), called from a written C code, in C code to complete the dynamic loading of Java code. However, how does C load Java code? This requires proper knowledge of the JVM. So the time I thought it was not able to.

However, some common sense of recent contact tells me that--java is also able to add shells!!

1.URLClassLoader. This feature, in fact, is dynamically loaded with the ability to urlclassloader the Java program at run time and then add the folder or jar to the classpath. Since the ability to dynamically load class folder perhaps jar, why not enough to load the encrypted classes, will be classes in a method of encryption, in URLClassLoader call, the use of a method of decryption. Does it achieve the purpose of the Packers? But where the decrypted code is in doubt, that is, the code for the shell is exposed, which is still risky.

2.javassist. This is really a very strange new skill, I was learning Tapestry5 the first time I met this package, he was able to dynamically create Java bytecode, and even be able to modify the functions you have now written, such as your getter and setter, simply read and assign the value, You can use him to fix your getter and setter at runtime, allowing your getter and setter to trigger some code each time they are called. With this peculiar skill, it is bound to be able to perform stronger dynamic loading, and the Packers will be able to.

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.