by Higor  Wed Jun 26, 2013 5:00 am

This is entirely aimed at developers with basic knowledge about obfuscating packages.
Say you want to create a package with a certain protected function or variables, and you don't want to nuke the entire code or anything.

This thing is a native class that runs on the game.
Since I don't know much about licensing, I'll avoid posting the code for now.
The way it operates is kinda limited and prone to failures, i will explain below.

//Coding to make obfuscation possible
Any name in the name table (variables, functions, classes) can be replaced with gibberish with no problems as long as no external package is intended to read those without hacking.
Any PRIVATE VARIABLE name can be zero'd (no name, no possibility to access from external UScript) as long as all variables with this name are PRIVATE, and no functions or classes use said name.
Create a couple of unused variable names if you're going to do name zeroing (var int bogus; is a good example).
Source code can be partially blanked, even making unrealed unable to load the class's source by using OBFSTART and OBFEND statements inside the class, YOU MUST HAVE BOTH OPENING AND CLOSING STATEMENTS IN THE SAME CLASS.

//Launching the obfuscator
I didn't even bother with an interface or an application, so i used the game's own property window as interface.
Place all files on the \System\ folder.
Launch the game, windowed mode.
Since native packages fail to bind if loaded with inproper letter case, spawn the actor by using the "exec obfuscate" batch, it's just an extensionless text file that does this: summon Obfuscator.PackageObfuscator, editactor class=PackageObfuscator.
The obfuscator actor will be spawned and a window to access it's operating properties will show up immediately.

//How it works.
The obfuscator isn't smart, so you MUST read this carefully:
- Names are case sensitive, code all the vars, functions with same name in the package using the same Upper/Lower case combos. (Test,Test,Test is good) (Test,test,Test is bad).
- The name table will never vary in size, so won't the package. If you zero'd a name, you must increase the length of a different name, specify bogus names for that.
- Names can have up to 64 chars (63 to be safe), so count the chars of every name you remove, for every 40 chars you remove, add a new bogus name to increase length.
Old name table [removeme ;obfuscate ;bogus] > new name table [ ;.qt?ܺ ;bogusaaaaaaaa], as you can see, the name table doesn't vary in size, but when removing a name, it increases the length in another one.
- Never add non-existant names, the obfuscator doesn't check if those aren't in the package!
- All the data between OBFSTART and OBFEND (add those words in the script) will be zero'd.
- If you don't add an OBFEND after you add OBFSTART in the same class, the obfuscator will delete critical package data until it finds another OBFEND somewhere!, always add OBFEND in the same class after OBFSTART.


//Setting up the obfuscator
Open the [+] PackageObfuscator section on the property window.
Input package is the original package, Output is your edited package. Remember to keep the extension.
Setting bSave to TRUE will save the config, it will go back to FALSE immediately.
Setting bStartNow to TRUE will produce an obfuscated package.
The string arrays (Bogus,Delete,Obfuscate) don't need to be compacted, they work anyways.
When done, try to summon an actor from the newly created package (or load it on UnrealEd), if you get no crash then the package was properly baked   

//OBFSTART
When the obfuscator passes thru this thread, this line will cease to exist.  
//OBFEND
