JS-Confuser 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 a property code
which is the obfuscated code.
const JSConfuser = require("js-confuser");
const sourceCode = `console.log("Hello World")`;
const options = {
target: "node",
preset: "high"
};
JSConfuser.obfuscate(sourceCode, options).then(result=>{
// 'result' is now an object
- console.log(result);
+ console.log(result.code);
});
These features have been removed but you can still add these locks using the lock.customLocks
option.
{
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: 25, // Default = 25 - 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
Similar to JScrambler's Variable Masking
const options = {
target: "node",
preset: "high"
- stack: true,
+ variableMasking: true
};