js-confuser
Version:
JavaScript Obfuscation Tool.
57 lines (42 loc) • 1.64 kB
Markdown
2.0 is complete rewrite of the original JS-Confuser created in 2020!
The method `JSConfuser.obfuscate()` resolves to a object now instead of a string. This result object contains the obfuscated code on the `code` property.
```diff
+JSConfuser.obfuscate(sourceCode, options).then(result=>{
+ console.log(result.code);
+});
-JSConfuser.obfuscate(sourceCode, options).then(obfuscatedCode=>{
- console.log(obfuscatedCode);
-});
```
These features have been removed but you can still add these locks using the `lock.customLocks` option.
```js
{
target: "node",
// ... Your obfuscator settings ...
lock: {
customLocks: [
{
code: `
// This code will be sprinkled throughout your source code
// (Will also be obfuscated)
if( window.navigator.userAgent.includes('Chrome') ){
{countermeasures}
}
// The {countermeasures} template variable is required.
// Must be placed in a Block or Switch Case body
`,
percentagePerBlock: 0.1, // = 10%
maxCount: 100, // Default = 100 - You probably don't want an excessive amount placed
minCount: 1 // Default = 1 - Ensures this custom lock is placed
}
]
}
}
```
The option `stack` has been renamed to `variableMasking`
[ ](https://docs.jscrambler.com/code-integrity/documentation/transformations/variable-masking)
JS-Confuser