Countermeasures

A custom callback function to invoke when a lock is triggered.

Option name: "lock.countermeasures"

Option value: string


Input / Output

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

Input.js

Output.js


Crash Process

The default behavior is to crash the process This is done by an infinite loop to ensure the process becomes useless.

Code

Custom Callback

By setting countermeasures to a string, it can point to a callback to invoke when a lock is triggered. The countermeasures callback function can either be a local name or an external name.

Examples:

  • "onLockTriggered"
  • "window.onLockTriggered"

If the function is defined within the locked code, it must follow the local name rules.

Local Name rules

  1. The function must be defined at the top-level of your program.
  2. The function must not rely on any scoped variables.
  3. The function cannot call functions outside it's context.

These rules are necessary to prevent an infinite loop from occurring.

Test your countermeasure

Domain Lock:

Try your code within DevTools while on another website.

Time Lock:

Try setting your machine time to before or past the allowed range.

Integrity:

Try changing a string within your code.


Usage Example

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

Usage Example


Enabled In

See Also