如何使用 proguard 混淆 war 文件

发布于 2024-08-25 09:14:57 字数 49 浏览 3 评论 0原文

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

I want to obfuscate a war file using proguard,how can i do so ?
Please explain me the steps

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Oo萌小芽oO 2024-09-01 09:14:57

这个问题我很疑惑。

与其他 Java 混淆器一样,Proguard 通过重命名每个变量、方法等来混淆编译后的字节码(.class 文件)。它认为重命名是安全的。我想你知道这一点并且知道如何使用 Proguard 来处理类文件,因为你特别询问过它。如果没有,请阅读 proguard 手册。

对于war文件,您可以通过解压war(或jar)来提取类文件。 (是的,war 是一个普通的 zip 文件)。然后你可以通过 Proguard 运行它们并再次将其压缩。您可以使用 Winzip、unzip 或任何您喜欢的 zip 程序。您甚至可以使用 JDK 压缩和解压该 war (jar -xvf tobe_extracted.war)。

这种混淆不会影响 war 中的其他文件,例如属性文件、xml 文件等。战争没有加密。此后您的软件可能无法工作,因为基于反射的东西可能会被破坏。 Proguard 无法知道您的框架是否会利用其强大的反射魔法来访问某些内容,以及重命名它是否真的安全。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文