简体   繁体   English

调试java混淆代码

[英]Debugging java obfuscated code

We are going to obfuscate our project but don't want to lose the ability of remote debugging and hotswapping. 我们将模糊我们的项目,但不想失去远程调试和hotswapping的能力。

Is it possible? 可能吗? Which tools can handle this? 哪些工具可以处理这个? I'd be happy with simple obfuscation - just renaming classes/methods/variables. 我对简单的混淆感到满意 - 只需重命名类/方法/变量。

[Edited] We're using Intellij IDEA but wasn't able to find any plugin for this task. [已编辑]我们正在使用Intellij IDEA,但无法为此任务找到任何插件。

We have the same kind of needs (simple obfuscation, need to debug later) and we use ProGuard . 我们有相同的需求(简单的混淆,需要稍后调试),我们使用ProGuard It's a Java app, which can be integrated in an Ant task. 它是一个Java应用程序,可以集成到Ant任务中。

It can do a lot of things, but it's also fully tuneable. 它可以做很多事情,但它也可以完全调整。 So you can keep your obfuscation simple. 所以你可以简化你的混淆。 One of the options is to generate a "Symbol Correspondance Table", which allows you to retrive the non-obfucated code from the obfuscated one. 其中一个选项是生成“符号对应表”,它允许您从混淆的代码中检索未计算的代码。 (it keeps track that the variable xyz in the class qksdnqd is in fact myCuteVarName in the class MeaningfulClassName) (它跟踪类qksdnqd中的变量xyz实际上是在MeaningfulClassName类中的myCuteVarName)

Edit: Obfuscation can be tricky. 编辑:混淆可能很棘手。 Some examples: 一些例子:

  • You can't change the name of your main method. 您无法更改主方法的名称。
  • Do you use a classloader? 你使用了类加载器吗? Can it still retrieve the class after the obfuscation? 混淆后它还可以检索类吗?
  • What about your ORM Mapping? 你的ORM映射怎么样? Your Spring Context? 你的春天背景? (if any) (如果有的话)

Edit2: You can also see: 编辑2:您还可以看到:

See SD Java Obfuscator . 请参阅SD Java Obfuscator It strips comments and whitespace, and renames all members/methods/class names that aren't public. 它会删除注释和空格,并重命名非公共的所有成员/方法/类名。

It also providew you with a map of how the code was obfuscated, eg, for each symbol FOO obfuscated as XYZ, a map FOO->XYZ. 它还为您提供了代码如何被混淆的映射,例如,对于每个符号FOO被混淆为XYZ,地图FOO-> XYZ。 This means if you get a backtrace mentioning XYZ, you can easily determine the original symbol FOO. 这意味着如果您获得提及XYZ的回溯,您可以轻松确定原始符号FOO。 Of course, since only you (the person doing the obfuscation) has this map, only you can do this. 当然,因为只有你(做混淆的人)有这张地图,所以只有你能做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM