vimasig / Bozar

Java bytecode obfuscator with GUI
MIT License
152 stars 19 forks source link

Error with ConstantObfuscation, only obfuscates strings in methods not outside (not for all classes I dont think) "due to low method capacity" #12

Open Napoleon-x opened 2 years ago

Napoleon-x commented 2 years ago

Describe the bug When I try constant obfuscation, it seems to only obfuscate constants that are inside of a method and wont obfuscate the ones outside it

To Reproduce Turn on Constant Obfuscation, have strings outside of a method, The class must be slightly big ish, I cant give you access to the jar here on github because it contains private things but I can give you one if you have discord

Expected behaviour I wanted all strings to be obfuscated but it forgot some strings outside of methods and gave an error

Screenshots

image image image image image

Bozar version 1.7.0 built from master

Additional context Problem happened when I was trying to obfuscate an important joke java program with special strings, It fails at those strings with a "due to low method capacity" error

Napoleon-x commented 2 years ago

Maybe not as much as a "bug" as someone told me such constants need to have values assigned by a method to to be string obfuscated?, but most obfuscators should make a method or class to give constants its values and do this default? Superblaubeere27 (opensource) Obfuscator does something like this I am pretty sure, I am not very experienced in any of this java bytecode related things, perhaps you could also link me to useful sites to further improve my knowledge?

vimasig commented 2 years ago

I should add [WARN] prefix to that message :/ I explained the meaning of that warning in #11

About your question, we can assign String values to fields directly. But our goal is to scramble that logic using bytecode instructions. We can't add bytecode instructions to field nodes (afaik). We have to create a method to do that. We can also assign obfuscated String value first, then decrypt on all references (so it's possible but there are things like reflection, and finding references of that is hard).

And about your problem, try "Light" control flow obfuscation option. If it still gives that warning for most classes, then it means I should make a new lighter constant obfuscation 😀 You can also try moving some of your fields to an inner class as a workaround

vimasig commented 1 year ago

I should add [WARN] prefix to that message :/ I explained the meaning of that warning in #11 About your question, we can assign String values to fields directly. But our goal is to scramble that logic using bytecode instructions. We can't add bytecode instructions to field nodes (afaik). We have to create a method to do that. We can also assign obfuscated String value first, then decrypt on all references (so it's possible but there are things like reflection, and finding references of that is hard). And about your problem, try "Light" control flow obfuscation option. If it still gives that warning for most classes, then it means I should make a new lighter constant obfuscation 😀 You can also try moving some of your fields to an inner class as a workaround

now my program is not working

@Wenaly can you provide more details about the issue you're experiencing? Did the obfuscation process complete successfully?