I have some HTML/Javascript/WebGL code that I would like to obfuscate. My code consists of one .html file, several .js files and GLSL code embedded in the .html file.
I have found the tool UglifyJS that I can use to obfuscate the .js files one by one. I have also found the tool GLSL Compiler that I can use to obfuscate the GLSL code.
There is two problems with this approach:
Is there any tool or combination of tools that would give me a less manual and more complete obfuscation?
For JS I have always loved this script:
http://jsutility.pjoneil.net
I have multiple files of JS, running this as a batch script it combines all the files into a single file, obfuscates them, compacts them and then compresses them. It works great. I have got over 2mb of javascript to compress down to around 350kb using this plus its free!
Quick example, download code from website and then create a wsf file with roughly this.
<job id="ObfuscateJavascript">
<script language="VBScript">
Function WSHInputBox(Message, Title, Value)
WSHInputBox = InputBox(Message, Title, Value)
End Function
</script>
<reference object="Scripting.FileSystemObject" />
<script language="JScript" src="JSUtility_BatchCodeC.js" />
<script language="JScript">
var vbOKOnly = 0;
var vbInformation = 64;
var title = "What Project are you building for?";
var prompt = "Enter a file name:";
var WshShell = WScript.CreateObject("WScript.Shell");
var result = WSHInputBox(prompt, title, "FileName");
if (typeof result != "undefined") {
InputFiles.push("File1.js");
InputFiles.push("File2.js");
InputFiles.push("File3.js");
// Obfuscation options
Obfuscate.Options = {
DefinedGlobalVars: true,
ObjectMembers: false,
StringVariables: true,
MinimumStringLength: 12,
RestructureIfStmts: true
};
// Compaction options
Compact.Options = {
AddMissingSemicolons: true,
LeaveNewLines: false,
LeaveNewLineAndComment: false,
RemoveUnnecessarySemicolons: true
};
// Compression options
Compress.Options = {
ISO8859Compatable: true,
UTF8Compatible: true
};
// File output
OutputFile = result + ".min.js";
// Operations to apply to javascript
Operations = {
Validate: false,
Obfuscate: true,
Compact: true,
Compress: true,
StopOnWarning: false
};
JSUtilityBatch();
}
</script>
</job>
Then I create a bat file with this:
Script WSFFileNameYouUsed.wsf
pause
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With