How to obfuscate code without compiling the project?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 20:09:41

In your android-sdk directory, check the tools/proguard/bin directory: this includes some proguard executables (proguard is the tool used for obfuscation). I have never used them, but I'm convinced one of these executables can help you with your question (there is even one with a gui interface!).

I dont know about any pre-compile obfuscator , however i think what you desire can be achieved by following steps :

  1. Create a one-to-one mapping file of your function names to some gibberish text names . Similarly have same sort of mapping for variables . Define some useless loops / codeblocks which are ignored by JVM's on compilation and can be executed upon the start or end of methods (This will be stripped by compiler anyway ) .
  2. Now since you have mentioned Intellij Idea in your tags , you can use the Macro functionality in your ide and create a macro which replaces all the variable names and function names (or starting parentheses with useless code blocks ) .
  3. Save the macro with any name and whenever you want to view your code obfuscated , just execute the macro for obfuscation .
  4. Have a similar macro for unobfuscating as well so that you can revert back whenever you want . Meanwhile i haven't worked in intellij idea plugin much however you can create plugin which does the same work as macro quite comfortably .

If you are using Eclipse, you may want to install JadClipse to ease your workflow. It will open any binary class file in your workspace directly in the decompiled textual format.

Whether or not that class file is an obfuscated binary or not, depends on your remaining tool chain, of course.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!