6

我想使用 proguard 混淆战争文件,我该怎么做?
请解释一下步骤

4

1 回答 1

6

I'm puzzled by this question.

As other Java obfuscators, Proguard obfuscates the compiled bytecode (.class files) by renaming every variable, method etc. it considers safe to rename. I suppose you know this and know how to use Proguard for class files since you specifically asked about it. If not, read the proguard manual.

As for war files, you can extract the class files from war (or jar) by unzipping it. (yes, a war is a normal zip file). Then you can run them through Proguard and zip it up again. You can use Winzip, unzip or whatever zip program you prefer. You can even zip and unzip the war with JDK (jar -xvf tobe_extracted.war).

This obfuscation does not affect the other files inside the war, like properties files, xml files and such. The war is not encrypted. Your software may not work after this because reflection based stuff may be break. Proguard can't know whether your frameworks are going to access something with their mighty reflection magic and if it's actually safe to rename it.

于 2011-08-04T15:56:05.023 回答