How to obfuscate code without compiling a project?

Is there a way to obfuscate the code directly in the editor?

At this point, if I want to see the confusing code of my project, I need to compile the project, reverse engineer, and then view the code using tools like jd-gui .

You can achieve all this with some add-on so that I can compile the running code, i.e. make it work as it did before obfuscation.

Note

To clarify, I do not need to obfuscate the code when exporting , since this function is already present. I need to confuse the code in live without compiling it, or at least without exporting to apk.

+1
source share
3 answers

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

0
source

I do not know about any preliminary compilation obfuscators, however I think that you can achieve the following steps:

  • Create an individual file for mapping the names of your functions to some gibberish text names. Similarly, they have the same mapping for variables. Define some useless loops / code blocks that the JVM ignores during compilation and can be executed at the beginning or at the end of methods (this will still be removed by the compiler).
  • Now that you have indicated Intellij Idea in your tags, you can use the Macro functionality in your idea and create a macro that replaces all variable names and function names (or starting parentheses with useless code blocks).
  • Save the macro with any name and whenever you want to view the running code, just run the macro to obfuscate.
  • You have a similar macro for unobfuscating so you can go back whenever you want. Meanwhile, I have not worked in the intellij idea plugin yet, but you can create a plugin that does the same job as the macro, quite conveniently.
0
source

If you use Eclipse, you can install JadClipse to make your workflow easier. It will open any binary class file in your workspace directly in decompiled text format.

Whether this class file is confusing binary or not depends on your remaining tool chain, of course.

0
source

All Articles