Java code encryption and decompilation (1) Encrypt the jar package with the obfuscation tool proGuard

               

The .class generated after the Java code is compiled contains all the information in the source code (not including comments), especially when debugging information is stored in it. So a Java .class file compiled in the normal way can be decompiled very easily. Normally, decompilation can take advantage of the existing tools jd-gui.exe or jad.exe.

(These two decompilation tools are available for download in my resources:

jd-gui.exe: ;

jad.exe: )

In some cases, in order to protect the java source code from being seen by others, the java source code is usually encrypted by means of encryption. The encryption method can use an encryption tool (such as a java code obfuscation tool) and an encryption algorithm (such as a DES algorithm) to modify the classloader. Encrypt the compiled .class file.

(Note: A java code obfuscator is recommended here, which can confuse function variables, classes, and method names to implement code encryption:proGuard:

 

First, useJava obfuscatorTool proGuard implements encryption

Here, proGuard is used to encrypt the jar package.

1. Unzip the downloaded proguard, extract it and enter the lib file to copy proguard.jar to your new folder.


2. Put the jars that the confusing jars and jars depend on in the newly created folder, and put them together, as shown below.


3. Write a configuration file, name itself, such as "a" file, give a simple configuration file example (that proguard.map is generated afterwards), the content is as follows, where -injars: is the jar you need to confuse, - Outjars: is the jar that you confuse after output, -libraryjars: is the jar package that you need to rely on the confusing jar, the latter does not explain one by one, you can refer to the proguard document, the configuration file can refer to the document to write your own confused needs Configuration file.

-injars       TheFirstDesktopApplication1.jar

-outjars      TheFirstDesktopApplication1_out.jar

-libraryjars  <java.home>/lib/rt.jar

-libraryjars appframework-1.0.3.jar

-libraryjarsswing-worker-1.1.jar

-printmappingproguard.map

-overloadaggressively

-defaultpackage ''

-allowaccessmodification

-dontoptimize

 

-keep public class*

{

 public protected *;

}

 

-keep public classorg.**

 

-keep public classit.**

 

4. Save the configuration file to the folder you created, as shown below.


5. Click Start, Run, type cmd, and enter the folder you built, as shown below.


6. Then enter the command statement: java -jarproguard.Jar @a and then press Enter, as shown below.



7. Confusion is successful, the TheFirstDesktopApplication1_out.jar is generated as shown below.


8. After the obfuscator, use the decompiler jad to decompile without TheFirstDesktopApplication1_out.jar, and a lot of class files such as a, b, c, etc., it is difficult to compile the decompiled java file, which means that the confusion is successful.

 

I tried it with the above method and found that the confusion is not good. I can easily see the source code using the jd-gui decompiler tool. To sum up, it’s not good to find a few code obfuscation tools on the Internet, and it seems that the tools are not so easy to use.

Then think about it, just change the way to directly decrypt the java code using the encryption algorithm. Write it again in the next article.

           

Then share the artificial intelligence tutorial of my teacher, God. Zero-based! Easy to understand! Humorous! Also with a yellow paragraph! I hope that you will also join our team of artificial intelligence!this link

Intelligent Recommendation

About ProGuard code obfuscation

various decompiler proliferation, as Android programmer only by manually adding 2.3 ProGuard previous version code obfuscation achieved, this tool is a tool ProGuard java code obfuscation. In the 2.3 ...

Android proguard code obfuscation

Why code obfuscation? Android installation files are in apk format.APK is an abbreviation of AndroidPackage.It is the installer file generated by the project package compiled by the Android SDK. Apk i...

Code obfuscation ProGuard

Introduction: ProGuard is a free Java file compressor, optimizer and obfuscator. It can find and delete useless classes, fields, methods, and attributes. It can also optimize bytecodes and remove usel...

Android code obfuscation encryption configuration (Proguard file analysis)

 In order to prevent our APP from being easily decompiled, we need to obfuscate the APK or special encryption. You can use the encryption service provided by "Love Encryption", only a f...

Android code obfuscation and decompilation

1. Purpose of confusion Used to protect APP from being cracked and reverse analysis. 2. The meaning of confusion Proguard compresses, optimizes, and obfuscates your code by removing unused code and re...

More Recommendation

Application decompilation and code obfuscation

01-Tools needed for decompilation To decompile apk, you need the following 3 tools: apktool (resource file acquisition) Function: resource file acquisition, you can extract picture files and layout fi...

Online decompilation of Java jar package

Online decompilation of Java jar package Online decompilation:http://www.decompiler.com 1. Drag the jar to be compiled into the cyan part of the webpage 2. Decompile 3. After compiling, select the dir...

Java code obfuscation and encryption - Jocky

The original address is: Java code obfuscation and encryption - Jocky   1.1 What isJocky? We know that Java is a cross-platform programming language whose source code (.java files) is compiled in...

Android proguard explain, code obfuscation

Brief introduction Java code is very easy to decompile. In order to be well protected Java source code, we have compiled class files tend to obfuscate. ProGuard is a confusing code open source project...

Android Advanced ProGuard of code obfuscation

Brief introduction ProguardTool by removing unused code and using semantic names obscure renaming classes, fields and methods to achieve compression and optimization purposes obfuscated code. Eventual...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top