RGF

RGF (Runtime-Generated-Functions) creates executable code from strings.

  • This can break your code.
  • Due to the security concerns of arbitrary code execution, you must enable this yourself.
  • The arbitrary code is also obfuscated.

Option name: "rgf"

Option values: true/false/0-1/Function



Input / Output

This example showcases how RGF transforms the code. Try it out by changing the input code and see changes apply in real-time.

Input.js

Loading...

Output.js

Loading...

Independent Functions

RGF will only transform functions that are independent of their scope. A function referencing a variable outside of its scope disqualifies it from being transformed.

If you enable Flatten, you can isolate functions from their original scope so then RGF can then apply on them. This is the recommended way to use RGF.


Custom Implementation

options.rgf(fnName)

Control which functions are changed. Returns a boolean.

Parameter Type Description
fnName string The function name proposed to be changed.

Usage Example

The provided code example will obfuscate the file input.js and write the output to a file named output.js.

Usage Example

Loading...

Enabled In

Other notes

RGF only applies to:

  • Function Declarations or Expressions
  • Cannot be async / generator function
  • Cannot rely on outside-scoped variables
  • Cannot use this, arguments, or eval

See Also