Javascript-obfuscator: Feature suggestions

Created on 11 Mar 2020  路  4Comments  路  Source: javascript-obfuscator/javascript-obfuscator

This project very good, so I use it in many of my projects, so I recommend the following suggestions here:

  • Multiple file processing
  • Preferred quote style for strings -- I very like use double quotes ^_^
  • When we turn on String Array, our array can consider using a single Unicode Escape Sequence. The remaining strings can be considered separately.
  • Substitute void 0 if there is a variable named undefined in scope (variable name will be mangled, typically reduced to a single character)

An example of a combination of obfuscate() options:

var SourceCodeList = {
    "test_1.js": "function hi(){console.log(\"Hello World!\");}hi();",
    "test_2.js": "console.log(\"Welcome use a free and efficient obfuscator for JavaScript\");"
};
var options = {
    compact: true,
    controlFlowFlattening: true,
    controlFlowFlatteningThreshold: 0.75,
    deadCodeInjection: true,
    deadCodeInjectionThreshold: 0.4,
    debugProtection: false,
    debugProtectionInterval: false,
    disableConsoleOutput: true,
    identifierNamesGenerator: 'hexadecimal',
    renameGlobals: false,
    rotateStringArray: true,
    selfDefending: true,
    shuffleStringArray: true,
    splitStrings: true,
    splitStringsChunkLength: '10',
    stringArray: true,
    stringArrayEncoding: 'base64',
    stringArrayThreshold: 0.75,
    transformObjectKeys: true,
    unicodeEscapeSequence: false
};
var obfuscationResult = JavaScriptObfuscator.obfuscate(SourceCodeList, options);
console.log(obfuscationResult.getObfuscatedCode());

Third point comparison

Before:

var _0x2e7f=['Hello\x20World!','log'];(function(_0x53d6b3,_0x2e7f7e){var _0x41301a=function(_0x3ed08d){while(--_0x3ed08d){_0x53d6b3['push'](_0x53d6b3['shift']());}};_0x41301a(++_0x2e7f7e);}(_0x2e7f,0x1c4));var _0x4130=function(_0x53d6b3,_0x2e7f7e){_0x53d6b3=_0x53d6b3-0x0;var _0x41301a=_0x2e7f[_0x53d6b3];return _0x41301a;};function hi(){console[_0x4130('0x1')](_0x4130('0x0'));}hi();

After:

var _0x2e7f=['\x6c\x6f\x67','\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x21'];(function(_0x53d6b3,_0x2e7f7e){var _0x41301a=function(_0x3ed08d){while(--_0x3ed08d){_0x53d6b3['push'](_0x53d6b3['shift']());}};_0x41301a(++_0x2e7f7e);}(_0x2e7f,0x1c4));var _0x4130=function(_0x53d6b3,_0x2e7f7e){_0x53d6b3=_0x53d6b3-0x0;var _0x41301a=_0x2e7f[_0x53d6b3];return _0x41301a;};function hi(){console[_0x4130('0x1')](_0x4130('0x0'));}hi();

enhancement future

Most helpful comment

Multiple sources obfuscation just released as 0.27.0 release

All 4 comments

Multiple sources obfuscation just released as 0.27.0 release

wow~like

I think the following encryption schemes can be tried for String Array Encoding

  • Quoted Printable
  • Crypto Rabbit
  • XXencode
  • UUencode
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

tyronedougherty picture tyronedougherty  路  5Comments

sanex3339 picture sanex3339  路  5Comments

madprops picture madprops  路  5Comments

invertedvisuals picture invertedvisuals  路  3Comments