TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pw4k/ironbrew-2/llms.txt
Use this file to discover all available pages before exploring further.
IB2 static class provides the core obfuscation functionality for IronBrew 2. It handles the complete obfuscation pipeline from input Lua script to obfuscated output.
Static Fields
Shared random number generator instance used throughout the obfuscation process
Methods
Obfuscate
Obfuscates a Lua script file with the specified settings.Working directory path for temporary files during obfuscation. The directory must exist before calling this method.
Absolute path to the input Lua script file to obfuscate. The file must exist and be a valid Lua script.
Configuration object controlling obfuscation behavior. See ObfuscationSettings for details.
Output parameter that receives error messages if obfuscation fails. Empty string on success.
Returns
true if obfuscation succeeded, false if it failed. Check the error parameter for failure details.Obfuscation Pipeline
TheObfuscate method executes the following steps:
- File Validation - Verifies input file exists and is valid Lua syntax using
luac - Comment Stripping - Removes comments using LuaSrcDiet while preserving code
- String Encryption - Encrypts string constants if enabled in settings
- Compilation - Compiles to Lua bytecode using
luac - Control Flow - Applies control flow obfuscation if enabled
- VM Generation - Generates custom virtual machine interpreter
- Minification - Minifies the output using LuaSrcDiet with maximum compression
- Watermark - Adds IronBrew 2 watermark and writes final output to
out.lua
Temporary Files
The method creates several temporary files in the working directory:luac.out- Compiled bytecodet0.lua- Comments strippedt1.lua- String encryptedt2.lua- VM generatedt3.lua- Minified outputout.lua- Final obfuscated script with watermark
Error Handling
The method catches all exceptions and returns error details through theerror parameter. Common errors include:
- Invalid input file path
- Lua syntax errors in input
- Missing
luacorluajitexecutables - Insufficient permissions for temporary directory
Platform Support
The method automatically detects the operating system:- Unix/Linux: Uses
/usr/bin/luacand/usr/bin/luajit - Windows: Uses
luacandluajitfrom PATH
Usage Example
The method requires
luac and luajit to be installed and available in the system PATH or /usr/bin/ directory.Source Reference
Source:IronBrew2/Program.cs:20