Scripting Engines & Obfuscation
I'm trying to obfuscate a project that uses the Rhino engine. It has many scripts that call upon methods from classes and I've been having difficulties making it work.
When it obfuscates, it changes the method names and thus makes the scripts call on inexistent class methods. The problem is, I could ke开发者_Go百科ep those classes from being obfuscated, but there are quite a number of them and I'd rather obfuscate them, for security purposes. Is there any way I could make this work?What obfuscator are you using? Looks like you're using a commercial one that does total obfuscation.
Obfuscation works in two modes:
1) Total obfuscation -- which means that you'll need to obfuscate ALL the source files. For things that you need to remain unchanged (so that you can call it from an outside script, say) you'll need to use your obfuscation software's "export" or "extern" or "prevent" lists. And you have to do that one by one. The good thing about this is that, if you throw in all your code, you don't have anything that you don't want to change (because there is, by definition, no outside code)
2) File obfuscation -- which means that the obfuscator will only change local variable names and optimize statements, but will not change public-facing names. Therefore, you "outside scripts" will continue to work. Most minifiers work in this mode, but the obfuscation value is very limited.
You have to pick among these two modes. They roughly correspond to the Closure Compiler's Simple and Advanced modes.
If you need to obfuscate your code to prevent reverse engineering, then you must use total obfuscation, in which case you'll just have to do the amount of work to prevent changing of unwanted names, or as I said, throw in all your code.
精彩评论