浏览代码

rc4 preparation

sanex3339 8 年之前
父节点
当前提交
add062feee
共有 21 个文件被更改,包括 150 次插入349 次删除
  1. 1 14
      README.md
  2. 57 121
      dist/index.js
  3. 1 2
      src/cli/JavaScriptObfuscatorCLI.ts
  4. 40 7
      src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts
  5. 0 101
      src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts
  6. 0 1
      src/interfaces/IObfuscatorOptions.d.ts
  7. 0 1
      src/interfaces/IOptions.d.ts
  8. 8 26
      src/node-groups/UnicodeArrayNodesGroup.ts
  9. 4 8
      src/node-obfuscators/replacers/StringLiteralReplacer.ts
  10. 0 6
      src/options/Options.ts
  11. 0 0
      src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/SelfDefendingTemplate.ts
  12. 12 0
      src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayAtobDecodeNodeTemplate.ts
  13. 6 2
      src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayCallsWrapperTemplate.ts
  14. 0 0
      src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayRC4DecodeNodeTemplate.ts
  15. 11 12
      test/functional-tests/JavaScriptObfuscator.spec.ts
  16. 4 12
      test/functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.spec.ts
  17. 0 29
      test/functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.spec.ts
  18. 2 2
      test/functional-tests/node-obfuscators/MemberExpressionObfuscator.spec.ts
  19. 1 1
      test/functional-tests/node-obfuscators/MethodDefinitionObfuscator.spec.ts
  20. 3 3
      test/functional-tests/templates/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNodeTemplate.spec.ts
  21. 0 1
      test/index.spec.ts

+ 1 - 14
README.md

@@ -126,8 +126,7 @@ Following options available for the JS Obfuscator:
     sourceMapFileName: '',
     sourceMapMode: 'separate',
     unicodeArray: true,
-    unicodeArrayThreshold: 0.8,
-    wrapUnicodeArrayCalls: true
+    unicodeArrayThreshold: 0.8
 }
 ```
 
@@ -153,7 +152,6 @@ Following options available for the JS Obfuscator:
     --sourceMapMode <string> [inline, separate]
     --unicodeArray <boolean>
     --unicodeArrayThreshold <number>
-    --wrapUnicodeArrayCalls <boolean>
 ```
 
 ### `compact`
@@ -292,17 +290,6 @@ This setting is useful with large code size because repeatdely calls to the `Uni
 
 `unicodeArrayThreshold: 0` equals to `unicodeArray: false`.
 
-### `wrapUnicodeArrayCalls`
-Type: `boolean` Default: `true`
-
-##### :warning: `unicodeArray` option must be enabled
-
-Replaces the direct array indexing `var m = _0x12c456[0x1];` with a call to a special function `var m = _0x23c123('0x1');`. Some JavaScript beautifiers (such as the Google Closure Compiler) can replace direct array indexing with the indexed string, and this option mitigates that.
-
-```javascript
-var t = _0x12a634('0x0')
-```
-
 ## License
 Copyright (C) 2016 [Timofey Kachalov](http://github.com/sanex3339).
 

+ 57 - 121
dist/index.js

@@ -938,14 +938,11 @@ var StringLiteralReplacer = function (_AbstractReplacer_1$A) {
                 unicodeArrayNode.updateNodeData(value);
             }
             hexadecimalIndex = new NumberLiteralReplacer_1.NumberLiteralReplacer(this.nodes, this.options).replace(indexOfValue);
-            if (this.options.wrapUnicodeArrayCalls) {
-                var unicodeArrayCallsWrapper = this.nodes.get('unicodeArrayCallsWrapper');
-                if (!unicodeArrayCallsWrapper) {
-                    throw new ReferenceError('`unicodeArrayCallsWrapper` node is not found in Map with custom nodes.');
-                }
-                return unicodeArrayCallsWrapper.getNodeIdentifier() + '(\'' + hexadecimalIndex + '\')';
+            var unicodeArrayCallsWrapper = this.nodes.get('unicodeArrayCallsWrapper');
+            if (!unicodeArrayCallsWrapper) {
+                throw new ReferenceError('`unicodeArrayCallsWrapper` node is not found in Map with custom nodes.');
             }
-            return unicodeArrayNode.getNodeIdentifier() + '[' + hexadecimalIndex + ']';
+            return unicodeArrayCallsWrapper.getNodeIdentifier() + '(\'' + hexadecimalIndex + '\')';
         }
     }]);
 
@@ -1614,11 +1611,11 @@ var JavaScriptObfuscatorCLI = function () {
     }, {
         key: 'configureCommands',
         value: function configureCommands() {
-            this.commands = new commander.Command().version(JavaScriptObfuscatorCLI.getBuildVersion(), '-v, --version').usage('<inputPath> [options]').option('-o, --output <path>', 'Output path for obfuscated code').option('--compact <boolean>', 'Disable one line output code compacting', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean).option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean).option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', function (val) {
+            this.commands = new commander.Command().version(JavaScriptObfuscatorCLI.getBuildVersion(), '-v, --version').usage('<inputPath> [options]').option('-o, --output <path>', 'Output path for obfuscated code').option('--compact <boolean>', 'Disable one line output code compacting', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean).option('--domainLock <list>', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', function (val) {
                 return val.split(',');
-            }).option('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean).option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMap <boolean>', 'Enables source map generation', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMapBaseUrl <string>', 'Sets base url to the source map import url when `--sourceMapMode=separate`').option('--sourceMapFileName <string>', 'Sets file name for output source map when `--sourceMapMode=separate`').option('--sourceMapMode <string> [inline, separate]', 'Specify source map output mode', JavaScriptObfuscatorCLI.parseSourceMapMode).option('--unicodeArray <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', JavaScriptObfuscatorCLI.parseBoolean).option('--unicodeArrayThreshold <number>', 'The probability that the literal string will be inserted into unicodeArray (Default: 0.8, Min: 0, Max: 1)', parseFloat).option('--wrapUnicodeArrayCalls <boolean>', 'Disables usage of special access function instead of direct array call', JavaScriptObfuscatorCLI.parseBoolean).option('--domainLock <list>', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', function (val) {
+            }).option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean).option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', function (val) {
                 return val.split(',');
-            }).parse(this.rawArguments);
+            }).option('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean).option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMap <boolean>', 'Enables source map generation', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMapBaseUrl <string>', 'Sets base url to the source map import url when `--sourceMapMode=separate`').option('--sourceMapFileName <string>', 'Sets file name for output source map when `--sourceMapMode=separate`').option('--sourceMapMode <string> [inline, separate]', 'Specify source map output mode', JavaScriptObfuscatorCLI.parseSourceMapMode).option('--unicodeArray <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', JavaScriptObfuscatorCLI.parseBoolean).option('--unicodeArrayThreshold <number>', 'The probability that the literal string will be inserted into unicodeArray (Default: 0.8, Min: 0, Max: 1)', parseFloat).parse(this.rawArguments);
             this.commands.on('--help', function () {
                 console.log('  Examples:\n');
                 console.log('    %> javascript-obfuscator in.js --compact true --selfDefending false');
@@ -2043,10 +2040,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
 
 __webpack_require__(8);
 var AppendState_1 = __webpack_require__(4);
+var NoCustomNodesPreset_1 = __webpack_require__(17);
+var AtobTemplate_1 = __webpack_require__(62);
+var SelfDefendingTemplate_1 = __webpack_require__(83);
 var UnicodeArrayCallsWrapperTemplate_1 = __webpack_require__(69);
 var AbstractCustomNode_1 = __webpack_require__(5);
+var JavaScriptObfuscator_1 = __webpack_require__(9);
 var NodeUtils_1 = __webpack_require__(1);
-var Utils_1 = __webpack_require__(0);
+var UnicodeArrayAtobDecodeNodeTemplate_1 = __webpack_require__(84);
 
 var UnicodeArrayCallsWrapper = function (_AbstractCustomNode_) {
     _inherits(UnicodeArrayCallsWrapper, _AbstractCustomNode_);
@@ -2082,79 +2083,8 @@ var UnicodeArrayCallsWrapper = function (_AbstractCustomNode_) {
             return _get(UnicodeArrayCallsWrapper.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayCallsWrapper.prototype), 'getNode', this).call(this);
         }
     }, {
-        key: 'getNodeStructure',
-        value: function getNodeStructure() {
-            var keyName = Utils_1.Utils.getRandomVariableName();
-            return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayCallsWrapperTemplate_1.UnicodeArrayCallsWrapperTemplate().formatUnicorn({
-                keyName: keyName,
-                unicodeArrayCallsWrapperName: this.unicodeArrayCallsWrapperName,
-                unicodeArrayName: this.unicodeArrayName
-            }));
-        }
-    }]);
-
-    return UnicodeArrayCallsWrapper;
-}(AbstractCustomNode_1.AbstractCustomNode);
-
-exports.UnicodeArrayCallsWrapper = UnicodeArrayCallsWrapper;
-
-/***/ },
-/* 38 */
-/***/ function(module, exports, __webpack_require__) {
-
-"use strict";
-"use strict";
-
-var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
-
-var _get = (function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } });
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-__webpack_require__(8);
-var AppendState_1 = __webpack_require__(4);
-var NoCustomNodesPreset_1 = __webpack_require__(17);
-var AtobTemplate_1 = __webpack_require__(62);
-var SelfDefendingTemplate_1 = __webpack_require__(70);
-var UnicodeArrayDecodeNodeTemplate_1 = __webpack_require__(71);
-var AbstractCustomNode_1 = __webpack_require__(5);
-var JavaScriptObfuscator_1 = __webpack_require__(9);
-var NodeUtils_1 = __webpack_require__(1);
-
-var UnicodeArrayDecodeNode = function (_AbstractCustomNode_) {
-    _inherits(UnicodeArrayDecodeNode, _AbstractCustomNode_);
-
-    function UnicodeArrayDecodeNode(unicodeArrayName, unicodeArray, options) {
-        _classCallCheck(this, UnicodeArrayDecodeNode);
-
-        var _this = _possibleConstructorReturn(this, (UnicodeArrayDecodeNode.__proto__ || Object.getPrototypeOf(UnicodeArrayDecodeNode)).call(this, options));
-
-        _this.appendState = AppendState_1.AppendState.AfterObfuscation;
-        _this.unicodeArrayName = unicodeArrayName;
-        _this.unicodeArray = unicodeArray;
-        return _this;
-    }
-
-    _createClass(UnicodeArrayDecodeNode, [{
-        key: 'appendNode',
-        value: function appendNode(blockScopeNode) {
-            if (!this.unicodeArray.getLength()) {
-                return;
-            }
-            NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
-        }
-    }, {
-        key: 'getNode',
-        value: function getNode() {
-            return _get(UnicodeArrayDecodeNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), 'getNode', this).call(this);
-        }
-    }, {
-        key: 'getNodeStructure',
-        value: function getNodeStructure() {
+        key: 'getDecodeUnicodeArrayTemplate',
+        value: function getDecodeUnicodeArrayTemplate() {
             var forLoopFunctionName = 'forLoopFunc';
             var code = void 0;
             if (this.options.selfDefending) {
@@ -2165,21 +2095,32 @@ var UnicodeArrayDecodeNode = function (_AbstractCustomNode_) {
             } else {
                 code = forLoopFunctionName + '();';
             }
-            return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(UnicodeArrayDecodeNodeTemplate_1.UnicodeArrayDecodeNodeTemplate().formatUnicorn({
+            return UnicodeArrayAtobDecodeNodeTemplate_1.UnicodeArrayAtobDecodeNodeTemplate().formatUnicorn({
                 atobPolyfill: AtobTemplate_1.AtobTemplate(),
                 code: code,
                 forLoopFunctionName: forLoopFunctionName,
                 unicodeArrayName: this.unicodeArrayName
+            });
+        }
+    }, {
+        key: 'getNodeStructure',
+        value: function getNodeStructure() {
+            var decodeNodeTemplate = this.options.encodeUnicodeLiterals ? this.getDecodeUnicodeArrayTemplate() : '';
+            return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(UnicodeArrayCallsWrapperTemplate_1.UnicodeArrayCallsWrapperTemplate().formatUnicorn({
+                decodeNodeTemplate: decodeNodeTemplate,
+                unicodeArrayCallsWrapperName: this.unicodeArrayCallsWrapperName,
+                unicodeArrayName: this.unicodeArrayName
             }), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode());
         }
     }]);
 
-    return UnicodeArrayDecodeNode;
+    return UnicodeArrayCallsWrapper;
 }(AbstractCustomNode_1.AbstractCustomNode);
 
-exports.UnicodeArrayDecodeNode = UnicodeArrayDecodeNode;
+exports.UnicodeArrayCallsWrapper = UnicodeArrayCallsWrapper;
 
 /***/ },
+/* 38 */,
 /* 39 */
 /***/ function(module, exports, __webpack_require__) {
 
@@ -2517,7 +2458,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
 var AbstractNodesGroup_1 = __webpack_require__(10);
 var UnicodeArray_1 = __webpack_require__(28);
 var UnicodeArrayCallsWrapper_1 = __webpack_require__(37);
-var UnicodeArrayDecodeNode_1 = __webpack_require__(38);
 var UnicodeArrayNode_1 = __webpack_require__(39);
 var UnicodeArrayRotateFunctionNode_1 = __webpack_require__(40);
 var Utils_1 = __webpack_require__(0);
@@ -2546,12 +2486,7 @@ var UnicodeArrayNodesGroup = function (_AbstractNodesGroup_) {
         var unicodeArray = new UnicodeArray_1.UnicodeArray(),
             unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(unicodeArray, _this.unicodeArrayName, _this.unicodeArrayRotateValue, _this.options);
         _this.nodes.set('unicodeArrayNode', unicodeArrayNode);
-        if (_this.options.wrapUnicodeArrayCalls) {
-            _this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(_this.unicodeArrayTranslatorName, _this.unicodeArrayName, unicodeArray, _this.options));
-        }
-        if (_this.options.encodeUnicodeLiterals) {
-            _this.nodes.set('unicodeArrayDecodeNode', new UnicodeArrayDecodeNode_1.UnicodeArrayDecodeNode(_this.unicodeArrayName, unicodeArray, _this.options));
-        }
+        _this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(_this.unicodeArrayTranslatorName, _this.unicodeArrayName, unicodeArray, _this.options));
         if (_this.options.rotateUnicodeArray) {
             _this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(_this.unicodeArrayName, unicodeArray, _this.unicodeArrayRotateValue, _this.options));
         }
@@ -3271,7 +3206,6 @@ __decorate([class_validator_1.IsString(), __metadata('design:type', String)], Op
 __decorate([class_validator_1.IsIn(['inline', 'separate']), __metadata('design:type', typeof (_a = typeof TSourceMapMode_1.TSourceMapMode !== 'undefined' && TSourceMapMode_1.TSourceMapMode) === 'function' && _a || Object)], Options.prototype, "sourceMapMode", void 0);
 __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "unicodeArray", void 0);
 __decorate([class_validator_1.IsNumber(), class_validator_1.Min(0), class_validator_1.Max(1), __metadata('design:type', Number)], Options.prototype, "unicodeArrayThreshold", void 0);
-__decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "wrapUnicodeArrayCalls", void 0);
 exports.Options = Options;
 var _a;
 
@@ -3949,36 +3883,13 @@ exports.SelfDefendingTemplate = SelfDefendingTemplate;
 "use strict";
 
 function UnicodeArrayCallsWrapperTemplate() {
-    return "\n        var {unicodeArrayCallsWrapperName} = function ({keyName}) {\n            return {unicodeArrayName}[parseInt({keyName}, 0x010)];\n        };\n    ";
+    return "\n        var {unicodeArrayCallsWrapperName} = function (index, key) {\n            var value = {unicodeArrayName}[parseInt(index, 0x010)]\n            \n            {decodeNodeTemplate}\n        \n            return value;\n        };\n    ";
 }
 exports.UnicodeArrayCallsWrapperTemplate = UnicodeArrayCallsWrapperTemplate;
 
 /***/ },
-/* 70 */
-/***/ function(module, exports, __webpack_require__) {
-
-"use strict";
-"use strict";
-
-var Utils_1 = __webpack_require__(0);
-function SelfDefendingTemplate() {
-    return '\n        var func = function(){return \'dev\';};\n           \n        Function(' + Utils_1.Utils.stringToUnicode('return/\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}/') + ')()[\'test\'](func[\'toString\']()) !== true && !{unicodeArrayName}++ ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(true){}\')() : Function(\'a\', atob(' + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + '))({forLoopFunctionName}) ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')();\n    ';
-}
-exports.SelfDefendingTemplate = SelfDefendingTemplate;
-
-/***/ },
-/* 71 */
-/***/ function(module, exports) {
-
-"use strict";
-"use strict";
-
-function UnicodeArrayDecodeNodeTemplate() {
-    return "\n        (function () {\n           {atobPolyfill}\n          \n            var {forLoopFunctionName} = function () {\n                var array = [];\n                \n                for (var i in {unicodeArrayName}) {\n                    array['push'](decodeURI(atob({unicodeArrayName}[i])));\n                }\n                \n                {unicodeArrayName} = array;\n            };\n            \n            {code}\n        })();\n    ";
-}
-exports.UnicodeArrayDecodeNodeTemplate = UnicodeArrayDecodeNodeTemplate;
-
-/***/ },
+/* 70 */,
+/* 71 */,
 /* 72 */
 /***/ function(module, exports) {
 
@@ -4066,6 +3977,31 @@ if (!global._babelPolyfill) {
 }
 module.exports = JavaScriptObfuscator_1.JavaScriptObfuscator;
 
+/***/ },
+/* 83 */
+/***/ function(module, exports, __webpack_require__) {
+
+"use strict";
+"use strict";
+
+var Utils_1 = __webpack_require__(0);
+function SelfDefendingTemplate() {
+    return '\n        var func = function(){return \'dev\';};\n           \n        Function(' + Utils_1.Utils.stringToUnicode('return/\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}/') + ')()[\'test\'](func[\'toString\']()) !== true && !{unicodeArrayName}++ ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(true){}\')() : Function(\'a\', atob(' + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + '))({forLoopFunctionName}) ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')();\n    ';
+}
+exports.SelfDefendingTemplate = SelfDefendingTemplate;
+
+/***/ },
+/* 84 */
+/***/ function(module, exports) {
+
+"use strict";
+"use strict";
+
+function UnicodeArrayAtobDecodeNodeTemplate() {
+    return "\n        var decodedIndices = [];\n    \n        if (decodedIndices.indexOf(index) === -1) {\n            value = atob(value);\n        }\n    ";
+}
+exports.UnicodeArrayAtobDecodeNodeTemplate = UnicodeArrayAtobDecodeNodeTemplate;
+
 /***/ }
 /******/ ]);
 //# sourceMappingURL=index.js.map

+ 1 - 2
src/cli/JavaScriptObfuscatorCLI.ts

@@ -126,6 +126,7 @@ export class JavaScriptObfuscatorCLI {
             .option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean)
             .option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean)
             .option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean)
+            .option('--domainLock <list>', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', (val: string) => val.split(','))
             .option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean)
             .option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', (val: string) => val.split(','))
             .option('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean)
@@ -140,8 +141,6 @@ export class JavaScriptObfuscatorCLI {
             )
             .option('--unicodeArray <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', JavaScriptObfuscatorCLI.parseBoolean)
             .option('--unicodeArrayThreshold <number>', 'The probability that the literal string will be inserted into unicodeArray (Default: 0.8, Min: 0, Max: 1)', parseFloat)
-            .option('--wrapUnicodeArrayCalls <boolean>', 'Disables usage of special access function instead of direct array call', JavaScriptObfuscatorCLI.parseBoolean)
-            .option('--domainLock <list>', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', (val: string) => val.split(','))
             .parse(this.rawArguments);
 
         this.commands.on('--help', () => {

+ 40 - 7
src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts

@@ -8,12 +8,17 @@ import { TNodeWithBlockStatement } from '../../types/TNodeWithBlockStatement';
 
 import { AppendState } from '../../enums/AppendState';
 
+import { NO_CUSTOM_NODES_PRESET } from '../../preset-options/NoCustomNodesPreset';
+
+import { AtobTemplate } from '../../templates/custom-nodes/AtobTemplate';
+import { SelfDefendingTemplate } from '../../templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/SelfDefendingTemplate';
 import { UnicodeArrayCallsWrapperTemplate } from '../../templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayCallsWrapperTemplate';
 
 import { AbstractCustomNode } from '../AbstractCustomNode';
+import { JavaScriptObfuscator } from '../../JavaScriptObfuscator';
 import { NodeUtils } from '../../NodeUtils';
 import { UnicodeArray } from '../../UnicodeArray';
-import { Utils } from '../../Utils';
+import { UnicodeArrayAtobDecodeNodeTemplate } from '../../templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayAtobDecodeNodeTemplate';
 
 export class UnicodeArrayCallsWrapper extends AbstractCustomNode {
     /**
@@ -80,18 +85,46 @@ export class UnicodeArrayCallsWrapper extends AbstractCustomNode {
         return super.getNode();
     }
 
+    /**
+     * @returns {any}
+     */
+    protected getDecodeUnicodeArrayTemplate (): string {
+        const forLoopFunctionName: string = 'forLoopFunc';
+
+        let code: string;
+
+        if (this.options.selfDefending) {
+            code = SelfDefendingTemplate().formatUnicorn({
+                forLoopFunctionName,
+                unicodeArrayName: this.unicodeArrayName
+            });
+        } else {
+            code = `${forLoopFunctionName}();`;
+        }
+
+        return UnicodeArrayAtobDecodeNodeTemplate().formatUnicorn({
+            atobPolyfill: AtobTemplate(),
+            code,
+            forLoopFunctionName,
+            unicodeArrayName: this.unicodeArrayName
+        })
+    }
+
     /**
      * @returns {ESTree.Node}
      */
     protected getNodeStructure (): ESTree.Node {
-        let keyName: string = Utils.getRandomVariableName();
+        let decodeNodeTemplate: string = this.options.encodeUnicodeLiterals ? this.getDecodeUnicodeArrayTemplate() : '';
 
         return NodeUtils.convertCodeToStructure(
-            UnicodeArrayCallsWrapperTemplate().formatUnicorn({
-                keyName: keyName,
-                unicodeArrayCallsWrapperName: this.unicodeArrayCallsWrapperName,
-                unicodeArrayName: this.unicodeArrayName
-            })
+            JavaScriptObfuscator.obfuscate(
+                UnicodeArrayCallsWrapperTemplate().formatUnicorn({
+                    decodeNodeTemplate: decodeNodeTemplate,
+                    unicodeArrayCallsWrapperName: this.unicodeArrayCallsWrapperName,
+                    unicodeArrayName: this.unicodeArrayName
+                }),
+                NO_CUSTOM_NODES_PRESET
+            ).getObfuscatedCode()
         );
     }
 }

+ 0 - 101
src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts

@@ -1,101 +0,0 @@
-import * as ESTree from 'estree';
-
-import 'format-unicorn';
-
-import { IOptions } from '../../interfaces/IOptions';
-
-import { TNodeWithBlockStatement } from '../../types/TNodeWithBlockStatement';
-
-import { AppendState } from '../../enums/AppendState';
-
-import { NO_CUSTOM_NODES_PRESET } from '../../preset-options/NoCustomNodesPreset';
-
-import { AtobTemplate } from '../../templates/custom-nodes/AtobTemplate';
-import { SelfDefendingTemplate } from '../../templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/SelfDefendingTemplate';
-import { UnicodeArrayDecodeNodeTemplate } from '../../templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/UnicodeArrayDecodeNodeTemplate';
-
-import { AbstractCustomNode } from '../AbstractCustomNode';
-import { JavaScriptObfuscator } from '../../JavaScriptObfuscator';
-import { NodeUtils } from '../../NodeUtils';
-import { UnicodeArray } from '../../UnicodeArray';
-
-export class UnicodeArrayDecodeNode extends AbstractCustomNode {
-    /**
-     * @type {AppendState}
-     */
-    protected appendState: AppendState = AppendState.AfterObfuscation;
-
-    /**
-     * @type {UnicodeArray}
-     */
-    private unicodeArray: UnicodeArray;
-
-    /**
-     * @type {string}
-     */
-    private unicodeArrayName: string;
-
-    /**
-     * @param unicodeArrayName
-     * @param unicodeArray
-     * @param options
-     */
-    constructor (
-        unicodeArrayName: string,
-        unicodeArray: UnicodeArray,
-        options: IOptions
-    ) {
-        super(options);
-
-        this.unicodeArrayName = unicodeArrayName;
-        this.unicodeArray = unicodeArray;
-    }
-
-    /**
-     * @param blockScopeNode
-     */
-    public appendNode (blockScopeNode: TNodeWithBlockStatement): void {
-        if (!this.unicodeArray.getLength()) {
-            return;
-        }
-
-        NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
-    }
-
-    /**
-     * @returns {ESTree.Node}
-     */
-    public getNode (): ESTree.Node {
-        return super.getNode();
-    }
-
-    /**
-     * @returns {ESTree.Node}
-     */
-    protected getNodeStructure (): ESTree.Node {
-        const forLoopFunctionName: string = 'forLoopFunc';
-
-        let code: string;
-
-        if (this.options.selfDefending) {
-            code = SelfDefendingTemplate().formatUnicorn({
-                forLoopFunctionName,
-                unicodeArrayName: this.unicodeArrayName
-            });
-        } else {
-            code = `${forLoopFunctionName}();`;
-        }
-
-        return NodeUtils.convertCodeToStructure(
-            JavaScriptObfuscator.obfuscate(
-                UnicodeArrayDecodeNodeTemplate().formatUnicorn({
-                    atobPolyfill: AtobTemplate(),
-                    code,
-                    forLoopFunctionName,
-                    unicodeArrayName: this.unicodeArrayName
-                }),
-                NO_CUSTOM_NODES_PRESET
-            ).getObfuscatedCode()
-        );
-    }
-}

+ 0 - 1
src/interfaces/IObfuscatorOptions.d.ts

@@ -16,6 +16,5 @@ export interface IObfuscatorOptions {
     sourceMapMode?: TSourceMapMode;
     unicodeArray?: boolean;
     unicodeArrayThreshold?: number;
-    wrapUnicodeArrayCalls?: boolean;
     [key: string]: any;
 }

+ 0 - 1
src/interfaces/IOptions.d.ts

@@ -16,5 +16,4 @@ export interface IOptions {
     readonly sourceMapMode: TSourceMapMode;
     readonly unicodeArray: boolean;
     readonly unicodeArrayThreshold: number;
-    readonly wrapUnicodeArrayCalls: boolean;
 }

+ 8 - 26
src/node-groups/UnicodeArrayNodesGroup.ts

@@ -3,7 +3,6 @@ import { IOptions } from '../interfaces/IOptions';
 import { AbstractNodesGroup } from './AbstractNodesGroup';
 import { UnicodeArray } from '../UnicodeArray';
 import { UnicodeArrayCallsWrapper } from '../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper';
-import { UnicodeArrayDecodeNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode';
 import { UnicodeArrayNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayNode';
 import { UnicodeArrayRotateFunctionNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode';
 import { Utils } from '../Utils';
@@ -51,34 +50,17 @@ export class UnicodeArrayNodesGroup extends AbstractNodesGroup {
                 this.options
             );
 
+        this.nodes.set('unicodeArrayNode', unicodeArrayNode);
         this.nodes.set(
-            'unicodeArrayNode',
-            unicodeArrayNode
+            'unicodeArrayCallsWrapper',
+            new UnicodeArrayCallsWrapper(
+                this.unicodeArrayTranslatorName,
+                this.unicodeArrayName,
+                unicodeArray,
+                this.options
+            )
         );
 
-        if (this.options.wrapUnicodeArrayCalls) {
-            this.nodes.set(
-                'unicodeArrayCallsWrapper',
-                new UnicodeArrayCallsWrapper(
-                    this.unicodeArrayTranslatorName,
-                    this.unicodeArrayName,
-                    unicodeArray,
-                    this.options
-                )
-            );
-        }
-
-        if (this.options.encodeUnicodeLiterals) {
-            this.nodes.set(
-                'unicodeArrayDecodeNode',
-                new UnicodeArrayDecodeNode (
-                    this.unicodeArrayName,
-                    unicodeArray,
-                    this.options
-                )
-            );
-        }
-
         if (this.options.rotateUnicodeArray) {
             this.nodes.set(
                 'unicodeArrayRotateFunctionNode',

+ 4 - 8
src/node-obfuscators/replacers/StringLiteralReplacer.ts

@@ -53,16 +53,12 @@ export class StringLiteralReplacer extends AbstractReplacer {
         hexadecimalIndex = new NumberLiteralReplacer(this.nodes, this.options)
             .replace(indexOfValue);
 
-        if (this.options.wrapUnicodeArrayCalls) {
-            const unicodeArrayCallsWrapper: TUnicodeArrayCallsWrapper = <TUnicodeArrayCallsWrapper>this.nodes.get('unicodeArrayCallsWrapper');
+        const unicodeArrayCallsWrapper: TUnicodeArrayCallsWrapper = <TUnicodeArrayCallsWrapper>this.nodes.get('unicodeArrayCallsWrapper');
 
-            if (!unicodeArrayCallsWrapper) {
-                throw new ReferenceError('`unicodeArrayCallsWrapper` node is not found in Map with custom nodes.');
-            }
-
-            return `${unicodeArrayCallsWrapper.getNodeIdentifier()}('${hexadecimalIndex}')`;
+        if (!unicodeArrayCallsWrapper) {
+            throw new ReferenceError('`unicodeArrayCallsWrapper` node is not found in Map with custom nodes.');
         }
 
-        return `${unicodeArrayNode.getNodeIdentifier()}[${hexadecimalIndex}]`;
+        return `${unicodeArrayCallsWrapper.getNodeIdentifier()}('${hexadecimalIndex}')`;
     }
 }

+ 0 - 6
src/options/Options.ts

@@ -139,12 +139,6 @@ export class Options implements IOptions {
     @Max(1)
     public readonly unicodeArrayThreshold: number;
 
-    /**
-     * @type {boolean}
-     */
-    @IsBoolean()
-    public readonly wrapUnicodeArrayCalls: boolean;
-
     /**
      * @param obfuscatorOptions
      */

+ 0 - 0
src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/SelfDefendingTemplate.ts → src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/SelfDefendingTemplate.ts


+ 12 - 0
src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayAtobDecodeNodeTemplate.ts

@@ -0,0 +1,12 @@
+/**
+ * @returns {string}
+ */
+export function UnicodeArrayAtobDecodeNodeTemplate (): string {
+    return `
+        var decodedIndices = [];
+    
+        if (decodedIndices.indexOf(index) === -1) {
+            value = atob(value);
+        }
+    `;
+}

+ 6 - 2
src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayCallsWrapperTemplate.ts

@@ -3,8 +3,12 @@
  */
 export function UnicodeArrayCallsWrapperTemplate (): string {
     return `
-        var {unicodeArrayCallsWrapperName} = function ({keyName}) {
-            return {unicodeArrayName}[parseInt({keyName}, 0x010)];
+        var {unicodeArrayCallsWrapperName} = function (index, key) {
+            var value = {unicodeArrayName}[parseInt(index, 0x010)]
+            
+            {decodeNodeTemplate}
+        
+            return value;
         };
     `;
 }

+ 0 - 0
src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/UnicodeArrayDecodeNodeTemplate.ts → src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayRC4DecodeNodeTemplate.ts


+ 11 - 12
test/functional-tests/JavaScriptObfuscator.spec.ts

@@ -102,29 +102,28 @@ describe('JavaScriptObfuscator', () => {
         });
 
         it('should obfuscate simple code with literal variable value', () => {
-            let pattern: RegExp = /^var _0x(\w){4} *= *\['(\\[x|u]\d+)+'\]; *var *test *= *_0x(\w){4}\[0x0\];$/;
-
-            assert.match(
-                JavaScriptObfuscator.obfuscate(
+            let pattern1: RegExp = /^var _0x(\w){4} *= *\['(\\[x|u]\d+)+'\];/,
+                pattern2: RegExp = /var *test *= *_0x(\w){4}\('0x0'\);$/,
+                obfuscatedCode1: string = JavaScriptObfuscator.obfuscate(
                     `var test = 'abc';`,
                     Object.assign({}, NO_CUSTOM_NODES_PRESET, {
                         unicodeArray: true,
                         unicodeArrayThreshold: 1
                     })
                 ).getObfuscatedCode(),
-                pattern
-            );
-
-            assert.match(
-                JavaScriptObfuscator.obfuscate(
+                obfuscatedCode2: string = JavaScriptObfuscator.obfuscate(
                     `var test = 'абц';`,
                     Object.assign({}, NO_CUSTOM_NODES_PRESET, {
                         unicodeArray: true,
                         unicodeArrayThreshold: 1
                     })
-                ).getObfuscatedCode(),
-                pattern
-            );
+                ).getObfuscatedCode();
+
+            assert.match(obfuscatedCode1, pattern1);
+            assert.match(obfuscatedCode1, pattern2);
+
+            assert.match(obfuscatedCode2, pattern1);
+            assert.match(obfuscatedCode2, pattern2);
         });
     });
 });

+ 4 - 12
test/functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.spec.ts

@@ -5,7 +5,7 @@ import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscator';
 const assert: Chai.AssertStatic = require('chai').assert;
 
 describe('UnicodeArrayCallsWrapper', () => {
-    it('should correctly appendNode `UnicodeArrayCallsWrapper` custom node into the obfuscated code if `wrapUnicodeArrayCalls` option is set', () => {
+    it('should correctly appendNode `UnicodeArrayCallsWrapper` custom node into the obfuscated code', () => {
         let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
             `var test = 'test';`,
             {
@@ -13,17 +13,9 @@ describe('UnicodeArrayCallsWrapper', () => {
             }
         );
 
-        assert.match(obfuscationResult.getObfuscatedCode(), /return _0x([a-z0-9]){4}\[parseInt\(_0x([a-z0-9]){4,6}, *0x010\)\];/);
-    });
-
-    it('should\'t appendNode `UnicodeArrayDecodeNode` custom node into the obfuscated code if `wrapUnicodeArrayCalls` option is not set', () => {
-        let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
-            `var test = 'test';`,
-            {
-                wrapUnicodeArrayCalls: false
-            }
+        assert.match(
+            obfuscationResult.getObfuscatedCode(),
+            /var *_0x([a-z0-9]){4,6} *= *_0x([a-z0-9]){4}\[parseInt\(_0x([a-z0-9]){4,6}, *0x10\)\];/
         );
-
-        assert.notMatch(obfuscationResult.getObfuscatedCode(), /return _0x([a-z0-9]){4}\[parseInt\(_0x([a-z0-9]){4,6}, *0x010\)\];/);
     });
 });

+ 0 - 29
test/functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.spec.ts

@@ -1,29 +0,0 @@
-import { IObfuscationResult } from '../../../../src/interfaces/IObfuscationResult';
-
-import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscator';
-
-const assert: Chai.AssertStatic = require('chai').assert;
-
-describe('UnicodeArrayDecodeNode', () => {
-    it('should correctly appendNode `UnicodeArrayDecodeNode` custom node into the obfuscated code if `encodeUnicodeLiterals` option is set', () => {
-        let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
-            `var test = 'test';`,
-            {
-                encodeUnicodeLiterals: true
-            }
-        );
-
-        assert.match(obfuscationResult.getObfuscatedCode(), /decodeURI\(atob\(_0x([a-z0-9]){4}\[_0x([a-z0-9]){4,6}\]\)\)/);
-    });
-
-    it('should\'t appendNode `UnicodeArrayDecodeNode` custom node into the obfuscated code if `encodeUnicodeLiterals` option is not set', () => {
-        let obfuscationResult: IObfuscationResult = JavaScriptObfuscator.obfuscate(
-            `var test = 'test';`,
-            {
-                encodeUnicodeLiterals: false
-            }
-        );
-
-        assert.notMatch(obfuscationResult.getObfuscatedCode(), /decodeURI\(atob\(_0x([a-z0-9]){4}\[_0x([a-z0-9]){4,6}\]\)\)/);
-    });
-});

+ 2 - 2
test/functional-tests/node-obfuscators/MemberExpressionObfuscator.spec.ts

@@ -27,7 +27,7 @@ describe('MemberExpressionObfuscator', () => {
             );
 
             assert.match(obfuscationResult.getObfuscatedCode(),  /var *_0x([a-z0-9]){4} *= *\['\\x6c\\x6f\\x67'\];/);
-            assert.match(obfuscationResult.getObfuscatedCode(),  /var *test *= *console\[_0x([a-z0-9]){4}\[0x0\]\];/);
+            assert.match(obfuscationResult.getObfuscatedCode(),  /var *test *= *console\[_0x([a-z0-9]){4}\('0x0'\)\];/);
         });
     });
 
@@ -42,7 +42,7 @@ describe('MemberExpressionObfuscator', () => {
             );
 
             assert.match(obfuscationResult.getObfuscatedCode(),  /var *_0x([a-z0-9]){4} *= *\['\\x6c\\x6f\\x67'\];/);
-            assert.match(obfuscationResult.getObfuscatedCode(),  /var *test *= *console\[_0x([a-z0-9]){4}\[0x0\]\];/);
+            assert.match(obfuscationResult.getObfuscatedCode(),  /var *test *= *console\[_0x([a-z0-9]){4}\('0x0'\)\];/);
         });
 
         it('should ignore square brackets call with identifier value', () => {

+ 1 - 1
test/functional-tests/node-obfuscators/MethodDefinitionObfuscator.spec.ts

@@ -33,7 +33,7 @@ describe('MethodDefinitionObfuscator', () => {
         );
 
         assert.match(obfuscationResult.getObfuscatedCode(),  /var *_0x([a-z0-9]){4} *= *\['\\x62\\x61\\x72'\];/);
-        assert.match(obfuscationResult.getObfuscatedCode(),  /\[_0x([a-z0-9]){4}\[0x0\]\]\(\)\{\}/);
+        assert.match(obfuscationResult.getObfuscatedCode(),  /\[_0x([a-z0-9]){4}\('0x0'\)\]\(\)\{\}/);
     });
 
     it('should not obfuscate method definition node with `constructor` key', () => {

+ 3 - 3
test/functional-tests/templates/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNodeTemplate.spec.ts

@@ -1,7 +1,7 @@
 import 'format-unicorn';
 
 import { AtobTemplate } from '../../../../../src/templates/custom-nodes/AtobTemplate';
-import { UnicodeArrayDecodeNodeTemplate } from '../../../../../src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/UnicodeArrayDecodeNodeTemplate';
+import { UnicodeArrayAtobDecodeNodeTemplate } from '../../../../../src/templates/custom-nodes/unicode-array-nodes/unicode-array-calls-wrapper/UnicodeArrayAtobDecodeNodeTemplate';
 
 import { Utils } from '../../../../../src/Utils';
 
@@ -13,7 +13,7 @@ const assert: Chai.AssertStatic = require('chai').assert;
  * @returns {Function}
  */
 function getFunctionFromTemplate (templateData: any, unicodeArrayName: string) {
-    let domainLockTemplate: string = UnicodeArrayDecodeNodeTemplate().formatUnicorn(templateData);
+    let domainLockTemplate: string = UnicodeArrayAtobDecodeNodeTemplate().formatUnicorn(templateData);
 
     return Function(`
         var ${unicodeArrayName} = ['${Utils.btoa('test1')}', '${Utils.btoa('test2')}'];
@@ -24,7 +24,7 @@ function getFunctionFromTemplate (templateData: any, unicodeArrayName: string) {
     `)();
 }
 
-describe('UnicodeArrayDecodeNodeTemplate (): string', () => {
+describe('UnicodeArrayAtobDecodeNodeTemplate (): string', () => {
     let forLoopFunctionName: string = 'forLoop',
         code: string = `${forLoopFunctionName}();`,
         unicodeArrayName: string = 'unicodeArray';

+ 0 - 1
test/index.spec.ts

@@ -27,7 +27,6 @@ import './functional-tests/JavaScriptObfuscatorInternal.spec';
 import './functional-tests/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.spec';
 import './functional-tests/custom-nodes/domain-lock-nodes/DomainLockNode.spec';
 import './functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.spec';
-import './functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.spec';
 import './functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.spec';
 import './functional-tests/custom-nodes/unicode-array-nodes/UnicodeArrayNode.spec';
 import './functional-tests/node-obfuscators/FunctionObfuscator.spec';