sanex3339 9 rokov pred
rodič
commit
171234250f

+ 2 - 1
dist/index.js

@@ -22,7 +22,8 @@ JavaScriptObfuscator.defaultOptions = {
     debugProtection: false,
     debugProtection: false,
     debugProtectionInterval: false,
     debugProtectionInterval: false,
     disableConsoleOutput: true,
     disableConsoleOutput: true,
-    rotateUnicodeArray: true
+    rotateUnicodeArray: true,
+    wrapUnicodeArrayCalls: false
 };
 };
 JavaScriptObfuscator.escodegenParams = {
 JavaScriptObfuscator.escodegenParams = {
     verbatim: 'x-verbatim-property'
     verbatim: 'x-verbatim-property'

+ 1 - 1
dist/src/Obfuscator.js

@@ -70,7 +70,7 @@ class Obfuscator {
             return;
             return;
         }
         }
         this.nodeObfuscators.get(node.type).forEach((obfuscator) => {
         this.nodeObfuscators.get(node.type).forEach((obfuscator) => {
-            new obfuscator(this.nodes).obfuscateNode(node, parentNode);
+            new obfuscator(this.nodes, this.options).obfuscateNode(node, parentNode);
         });
         });
     }
     }
     obfuscate(node) {
     obfuscate(node) {

+ 6 - 6
dist/src/custom-nodes/unicode-array-nodes/UnicodeArrayTranslator.js → dist/src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.js

@@ -4,11 +4,11 @@ const AppendState_1 = require("../../enums/AppendState");
 const Node_1 = require('../Node');
 const Node_1 = require('../Node');
 const NodeUtils_1 = require("../../NodeUtils");
 const NodeUtils_1 = require("../../NodeUtils");
 const Utils_1 = require("../../Utils");
 const Utils_1 = require("../../Utils");
-class UnicodeArrayTranslator extends Node_1.Node {
-    constructor(unicodeArrayTranslatorName, unicodeArrayName, unicodeArray) {
+class UnicodeArrayCallsWrapper extends Node_1.Node {
+    constructor(unicodeArrayCallsWrapperName, unicodeArrayName, unicodeArray) {
         super();
         super();
         this.appendState = AppendState_1.AppendState.AfterObfuscation;
         this.appendState = AppendState_1.AppendState.AfterObfuscation;
-        this.unicodeArrayTranslatorName = unicodeArrayTranslatorName;
+        this.unicodeArrayCallsWrapperName = unicodeArrayCallsWrapperName;
         this.unicodeArrayName = unicodeArrayName;
         this.unicodeArrayName = unicodeArrayName;
         this.unicodeArray = unicodeArray;
         this.unicodeArray = unicodeArray;
         this.node = this.getNodeStructure();
         this.node = this.getNodeStructure();
@@ -17,7 +17,7 @@ class UnicodeArrayTranslator extends Node_1.Node {
         NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
         NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
     }
     }
     getNodeIdentifier() {
     getNodeIdentifier() {
-        return this.unicodeArrayTranslatorName;
+        return this.unicodeArrayCallsWrapperName;
     }
     }
     ;
     ;
     getNode() {
     getNode() {
@@ -28,7 +28,7 @@ class UnicodeArrayTranslator extends Node_1.Node {
     }
     }
     getNodeStructure() {
     getNodeStructure() {
         let keyName = Utils_1.Utils.getRandomVariableName(), node = esprima.parse(`
         let keyName = Utils_1.Utils.getRandomVariableName(), node = esprima.parse(`
-                var ${this.unicodeArrayTranslatorName} = function (${keyName}) {
+                var ${this.unicodeArrayCallsWrapperName} = function (${keyName}) {
                     return ${this.unicodeArrayName}[[][${Utils_1.Utils.stringToUnicode('filter')}][${Utils_1.Utils.stringToUnicode('constructor')}](${Utils_1.Utils.stringToUnicode('return this')})()[${Utils_1.Utils.stringToUnicode('parseInt')}](${keyName})]
                     return ${this.unicodeArrayName}[[][${Utils_1.Utils.stringToUnicode('filter')}][${Utils_1.Utils.stringToUnicode('constructor')}](${Utils_1.Utils.stringToUnicode('return this')})()[${Utils_1.Utils.stringToUnicode('parseInt')}](${keyName})]
                 };
                 };
             `);
             `);
@@ -36,4 +36,4 @@ class UnicodeArrayTranslator extends Node_1.Node {
         return NodeUtils_1.NodeUtils.getBlockScopeNodeByIndex(node);
         return NodeUtils_1.NodeUtils.getBlockScopeNodeByIndex(node);
     }
     }
 }
 }
-exports.UnicodeArrayTranslator = UnicodeArrayTranslator;
+exports.UnicodeArrayCallsWrapper = UnicodeArrayCallsWrapper;

+ 4 - 5
dist/src/node-groups/UnicodeArrayNodesGroup.js

@@ -1,9 +1,9 @@
 "use strict";
 "use strict";
 const NodesGroup_1 = require('./NodesGroup');
 const NodesGroup_1 = require('./NodesGroup');
+const UnicodeArrayCallsWrapper_1 = require("../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper");
 const UnicodeArrayNode_1 = require('../custom-nodes/unicode-array-nodes/UnicodeArrayNode');
 const UnicodeArrayNode_1 = require('../custom-nodes/unicode-array-nodes/UnicodeArrayNode');
 const UnicodeArrayRotateFunctionNode_1 = require('../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode');
 const UnicodeArrayRotateFunctionNode_1 = require('../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode');
 const Utils_1 = require('../Utils');
 const Utils_1 = require('../Utils');
-const UnicodeArrayTranslator_1 = require("../custom-nodes/unicode-array-nodes/UnicodeArrayTranslator");
 class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
 class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
     constructor(options) {
     constructor(options) {
         super();
         super();
@@ -16,12 +16,11 @@ class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
             [
             [
                 'unicodeArrayNode',
                 'unicodeArrayNode',
                 unicodeArrayNode
                 unicodeArrayNode
-            ],
-            [
-                'unicodeArrayTranslator',
-                new UnicodeArrayTranslator_1.UnicodeArrayTranslator(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray)
             ]
             ]
         ]);
         ]);
+        if (this.options['wrapUnicodeArrayCalls']) {
+            this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray));
+        }
         if (this.options['rotateUnicodeArray']) {
         if (this.options['rotateUnicodeArray']) {
             this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(this.unicodeArrayName, unicodeArray, this.unicodeArrayRotateValue));
             this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(this.unicodeArrayName, unicodeArray, this.unicodeArrayRotateValue));
         }
         }

+ 1 - 1
dist/src/node-obfuscators/LiteralObfuscator.js

@@ -19,7 +19,7 @@ class LiteralObfuscator extends NodeObfuscator_1.NodeObfuscator {
                 content = this.replaceLiteralNumberByHexadecimalValue(literalNode.value);
                 content = this.replaceLiteralNumberByHexadecimalValue(literalNode.value);
                 break;
                 break;
             case 'string':
             case 'string':
-                content = this.replaceLiteralStringByUnicodeArrayTranslatorCall(literalNode.value);
+                content = this.replaceLiteralStringByUnicodeArrayCall(literalNode.value);
                 break;
                 break;
             default:
             default:
                 return;
                 return;

+ 2 - 2
dist/src/node-obfuscators/MemberExpressionObfuscator.js

@@ -26,7 +26,7 @@ class MemberExpressionObfuscator extends NodeObfuscator_1.NodeObfuscator {
         let nodeValue = node.name, literalNode = {
         let nodeValue = node.name, literalNode = {
             raw: `'${nodeValue}'`,
             raw: `'${nodeValue}'`,
             'x-verbatim-property': {
             'x-verbatim-property': {
-                content: this.replaceLiteralStringByUnicodeArrayTranslatorCall(nodeValue),
+                content: this.replaceLiteralStringByUnicodeArrayCall(nodeValue),
                 precedence: escodegen.Precedence.Primary
                 precedence: escodegen.Precedence.Primary
             },
             },
             type: NodeType_1.NodeType.Literal,
             type: NodeType_1.NodeType.Literal,
@@ -42,7 +42,7 @@ class MemberExpressionObfuscator extends NodeObfuscator_1.NodeObfuscator {
                     break;
                     break;
                 }
                 }
                 node['x-verbatim-property'] = {
                 node['x-verbatim-property'] = {
-                    content: this.replaceLiteralStringByUnicodeArrayTranslatorCall(node.value),
+                    content: this.replaceLiteralStringByUnicodeArrayCall(node.value),
                     precedence: escodegen.Precedence.Primary
                     precedence: escodegen.Precedence.Primary
                 };
                 };
                 break;
                 break;

+ 1 - 1
dist/src/node-obfuscators/MethodDefinitionObfuscator.js

@@ -18,7 +18,7 @@ class MethodDefinitionObfuscator extends NodeObfuscator_1.NodeObfuscator {
                     !Utils_1.Utils.arrayContains(this.ignoredNames, node.name) &&
                     !Utils_1.Utils.arrayContains(this.ignoredNames, node.name) &&
                     methodDefinitionNode.computed === false) {
                     methodDefinitionNode.computed === false) {
                     methodDefinitionNode.computed = true;
                     methodDefinitionNode.computed = true;
-                    node.name = this.replaceLiteralStringByUnicodeArrayTranslatorCall(node.name);
+                    node.name = this.replaceLiteralStringByUnicodeArrayCall(node.name);
                     return;
                     return;
                 }
                 }
                 return estraverse.VisitorOption.Skip;
                 return estraverse.VisitorOption.Skip;

+ 7 - 3
dist/src/node-obfuscators/NodeObfuscator.js

@@ -3,8 +3,9 @@ const JSFuck_1 = require("../enums/JSFuck");
 const NodeUtils_1 = require("../NodeUtils");
 const NodeUtils_1 = require("../NodeUtils");
 const Utils_1 = require('../Utils');
 const Utils_1 = require('../Utils');
 class NodeObfuscator {
 class NodeObfuscator {
-    constructor(nodes) {
+    constructor(nodes, options = {}) {
         this.nodes = nodes;
         this.nodes = nodes;
+        this.options = options;
     }
     }
     replaceNodeIdentifierByNewValue(node, parentNode, namesMap) {
     replaceNodeIdentifierByNewValue(node, parentNode, namesMap) {
         if (NodeUtils_1.NodeUtils.isIdentifierNode(node) && namesMap.has(node.name)) {
         if (NodeUtils_1.NodeUtils.isIdentifierNode(node) && namesMap.has(node.name)) {
@@ -25,7 +26,7 @@ class NodeObfuscator {
         }
         }
         return `${prefix}${Utils_1.Utils.decToHex(nodeValue)}`;
         return `${prefix}${Utils_1.Utils.decToHex(nodeValue)}`;
     }
     }
-    replaceLiteralStringByUnicodeArrayTranslatorCall(nodeValue) {
+    replaceLiteralStringByUnicodeArrayCall(nodeValue) {
         let value = Utils_1.Utils.stringToUnicode(nodeValue), unicodeArray = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex = unicodeArray.indexOf(value), index, hexadecimalIndex;
         let value = Utils_1.Utils.stringToUnicode(nodeValue), unicodeArray = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex = unicodeArray.indexOf(value), index, hexadecimalIndex;
         if (sameIndex < 0) {
         if (sameIndex < 0) {
             index = unicodeArray.length;
             index = unicodeArray.length;
@@ -35,7 +36,10 @@ class NodeObfuscator {
             index = sameIndex;
             index = sameIndex;
         }
         }
         hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
         hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
-        return `${this.nodes.get('unicodeArrayTranslator').getNodeIdentifier()}('${hexadecimalIndex}')`;
+        if (this.options['wrapUnicodeArrayCalls']) {
+            return `${this.nodes.get('unicodeArrayCallsWrapper').getNodeIdentifier()}('${hexadecimalIndex}')`;
+        }
+        return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${hexadecimalIndex}]`;
     }
     }
 }
 }
 exports.NodeObfuscator = NodeObfuscator;
 exports.NodeObfuscator = NodeObfuscator;

+ 2 - 1
index.ts

@@ -16,7 +16,8 @@ class JavaScriptObfuscator {
         debugProtection: false,
         debugProtection: false,
         debugProtectionInterval: false,
         debugProtectionInterval: false,
         disableConsoleOutput: true,
         disableConsoleOutput: true,
-        rotateUnicodeArray: true
+        rotateUnicodeArray: true,
+        wrapUnicodeArrayCalls: false
     };
     };
 
 
     /**
     /**

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "javascript-obfuscator",
   "name": "javascript-obfuscator",
-  "version": "0.4.3",
+  "version": "0.5.0",
   "description": "JavaScript obfuscator",
   "description": "JavaScript obfuscator",
   "keywords": [
   "keywords": [
     "obfuscator",
     "obfuscator",

+ 12 - 0
readme.md

@@ -101,3 +101,15 @@ which will rotate array values back to their original indexes.
 This option affected only on visual code organisation, because we can easily get original array during debug process.
 This option affected only on visual code organisation, because we can easily get original array during debug process.
 
 
 Not recommended for small source code, because helper function will attract attention.
 Not recommended for small source code, because helper function will attract attention.
+
+####wrapUnicodeArrayCalls
+Type: `boolean` Default: `false`
+
+#####This option have huge affect on performance! Use this option only on small pieces of code (< 5000 LOC)
+
+Instead using direct calls to `unicodeArray` items `var t = _0x43a123[0x0]`, 
+when index `0x0` can be easy reverted to `0` with few js beautifiers, this option wrap all calls to special function instead.
+
+```javascript
+`var t = _0x12a634('0x0')`
+```

+ 1 - 1
src/Obfuscator.ts

@@ -125,7 +125,7 @@ export class Obfuscator {
         }
         }
 
 
         this.nodeObfuscators.get(node.type).forEach((obfuscator: Function) => {
         this.nodeObfuscators.get(node.type).forEach((obfuscator: Function) => {
-            new (<INodeObfuscator> obfuscator(this.nodes)).obfuscateNode(node, parentNode);
+            new (<INodeObfuscator> obfuscator(this.nodes, this.options)).obfuscateNode(node, parentNode);
         });
         });
     }
     }
 
 

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

@@ -10,7 +10,7 @@ import { Node } from '../Node';
 import { NodeUtils } from "../../NodeUtils";
 import { NodeUtils } from "../../NodeUtils";
 import { Utils } from "../../Utils";
 import { Utils } from "../../Utils";
 
 
-export class UnicodeArrayTranslator extends Node {
+export class UnicodeArrayCallsWrapper extends Node {
     /**
     /**
      * @type {AppendState}
      * @type {AppendState}
      */
      */
@@ -29,21 +29,21 @@ export class UnicodeArrayTranslator extends Node {
     /**
     /**
      * @type {string}
      * @type {string}
      */
      */
-    private unicodeArrayTranslatorName: string;
+    private unicodeArrayCallsWrapperName: string;
 
 
     /**
     /**
-     * @param unicodeArrayTranslatorName
+     * @param unicodeArrayCallsWrapperName
      * @param unicodeArrayName
      * @param unicodeArrayName
      * @param unicodeArray
      * @param unicodeArray
      */
      */
     constructor (
     constructor (
-        unicodeArrayTranslatorName: string,
+        unicodeArrayCallsWrapperName: string,
         unicodeArrayName: string,
         unicodeArrayName: string,
         unicodeArray: string[]
         unicodeArray: string[]
     ) {
     ) {
         super();
         super();
 
 
-        this.unicodeArrayTranslatorName = unicodeArrayTranslatorName;
+        this.unicodeArrayCallsWrapperName = unicodeArrayCallsWrapperName;
         this.unicodeArrayName = unicodeArrayName;
         this.unicodeArrayName = unicodeArrayName;
         this.unicodeArray = unicodeArray;
         this.unicodeArray = unicodeArray;
 
 
@@ -61,7 +61,7 @@ export class UnicodeArrayTranslator extends Node {
      * @returns {string}
      * @returns {string}
      */
      */
     public getNodeIdentifier (): string {
     public getNodeIdentifier (): string {
-        return this.unicodeArrayTranslatorName;
+        return this.unicodeArrayCallsWrapperName;
     };
     };
 
 
     /**
     /**
@@ -81,7 +81,7 @@ export class UnicodeArrayTranslator extends Node {
     protected getNodeStructure (): any {
     protected getNodeStructure (): any {
         let keyName: string = Utils.getRandomVariableName(),
         let keyName: string = Utils.getRandomVariableName(),
             node: INode = esprima.parse(`
             node: INode = esprima.parse(`
-                var ${this.unicodeArrayTranslatorName} = function (${keyName}) {
+                var ${this.unicodeArrayCallsWrapperName} = function (${keyName}) {
                     return ${this.unicodeArrayName}[[][${Utils.stringToUnicode('filter')}][${Utils.stringToUnicode('constructor')}](${Utils.stringToUnicode('return this')})()[${Utils.stringToUnicode('parseInt')}](${keyName})]
                     return ${this.unicodeArrayName}[[][${Utils.stringToUnicode('filter')}][${Utils.stringToUnicode('constructor')}](${Utils.stringToUnicode('return this')})()[${Utils.stringToUnicode('parseInt')}](${keyName})]
                 };
                 };
             `);
             `);

+ 10 - 7
src/node-groups/UnicodeArrayNodesGroup.ts

@@ -1,10 +1,10 @@
 import { ICustomNode } from '../interfaces/ICustomNode';
 import { ICustomNode } from '../interfaces/ICustomNode';
 
 
 import { NodesGroup } from './NodesGroup';
 import { NodesGroup } from './NodesGroup';
+import { UnicodeArrayCallsWrapper } from "../custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper";
 import { UnicodeArrayNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayNode';
 import { UnicodeArrayNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayNode';
 import { UnicodeArrayRotateFunctionNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode';
 import { UnicodeArrayRotateFunctionNode } from '../custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode';
 import { Utils } from '../Utils';
 import { Utils } from '../Utils';
-import {UnicodeArrayTranslator} from "../custom-nodes/unicode-array-nodes/UnicodeArrayTranslator";
 
 
 export class UnicodeArrayNodesGroup extends NodesGroup {
 export class UnicodeArrayNodesGroup extends NodesGroup {
     /**
     /**
@@ -45,16 +45,19 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
             [
             [
                 'unicodeArrayNode',
                 'unicodeArrayNode',
                 unicodeArrayNode
                 unicodeArrayNode
-            ],
-            [
-                'unicodeArrayTranslator',
-                new UnicodeArrayTranslator(
+            ]
+        ]);
+
+        if (this.options['wrapUnicodeArrayCalls']) {
+            this.nodes.set(
+                'unicodeArrayCallsWrapper',
+                new UnicodeArrayCallsWrapper(
                     this.unicodeArrayTranslatorName,
                     this.unicodeArrayTranslatorName,
                     this.unicodeArrayName,
                     this.unicodeArrayName,
                     unicodeArray
                     unicodeArray
                 )
                 )
-            ]
-        ]);
+            );
+        }
 
 
         if (this.options['rotateUnicodeArray']) {
         if (this.options['rotateUnicodeArray']) {
             this.nodes.set(
             this.nodes.set(

+ 1 - 1
src/node-obfuscators/LiteralObfuscator.ts

@@ -35,7 +35,7 @@ export class LiteralObfuscator extends NodeObfuscator {
 
 
 
 
             case 'string':
             case 'string':
-                content = this.replaceLiteralStringByUnicodeArrayTranslatorCall(<string>literalNode.value);
+                content = this.replaceLiteralStringByUnicodeArrayCall(<string>literalNode.value);
 
 
                 break;
                 break;
 
 

+ 2 - 2
src/node-obfuscators/MemberExpressionObfuscator.ts

@@ -53,7 +53,7 @@ export class MemberExpressionObfuscator extends NodeObfuscator {
             literalNode: ILiteralNode = {
             literalNode: ILiteralNode = {
                 raw: `'${nodeValue}'`,
                 raw: `'${nodeValue}'`,
                 'x-verbatim-property': {
                 'x-verbatim-property': {
-                    content : this.replaceLiteralStringByUnicodeArrayTranslatorCall(nodeValue),
+                    content : this.replaceLiteralStringByUnicodeArrayCall(nodeValue),
                     precedence: escodegen.Precedence.Primary
                     precedence: escodegen.Precedence.Primary
                 },
                 },
                 type: NodeType.Literal,
                 type: NodeType.Literal,
@@ -82,7 +82,7 @@ export class MemberExpressionObfuscator extends NodeObfuscator {
                 }
                 }
 
 
                 node['x-verbatim-property'] = {
                 node['x-verbatim-property'] = {
-                    content : this.replaceLiteralStringByUnicodeArrayTranslatorCall(<string>node.value),
+                    content : this.replaceLiteralStringByUnicodeArrayCall(<string>node.value),
                     precedence: escodegen.Precedence.Primary
                     precedence: escodegen.Precedence.Primary
                 };
                 };
 
 

+ 1 - 1
src/node-obfuscators/MethodDefinitionObfuscator.ts

@@ -42,7 +42,7 @@ export class MethodDefinitionObfuscator extends NodeObfuscator {
                     methodDefinitionNode.computed === false
                     methodDefinitionNode.computed === false
                 ) {
                 ) {
                     methodDefinitionNode.computed = true;
                     methodDefinitionNode.computed = true;
-                    node.name = this.replaceLiteralStringByUnicodeArrayTranslatorCall(node.name);
+                    node.name = this.replaceLiteralStringByUnicodeArrayCall(node.name);
 
 
                     return;
                     return;
                 }
                 }

+ 14 - 3
src/node-obfuscators/NodeObfuscator.ts

@@ -13,11 +13,18 @@ export abstract class NodeObfuscator implements INodeObfuscator {
      */
      */
     protected nodes: Map <string, ICustomNode>;
     protected nodes: Map <string, ICustomNode>;
 
 
+    /**
+     * @type any
+     */
+    protected options: any;
+
     /**
     /**
      * @param nodes
      * @param nodes
+     * @param options
      */
      */
-    constructor(nodes: Map <string, ICustomNode>) {
+    constructor(nodes: Map <string, ICustomNode>, options: any = {}) {
         this.nodes = nodes;
         this.nodes = nodes;
+        this.options = options;
     }
     }
 
 
     /**
     /**
@@ -70,7 +77,7 @@ export abstract class NodeObfuscator implements INodeObfuscator {
      * @param nodeValue
      * @param nodeValue
      * @returns {string}
      * @returns {string}
      */
      */
-    protected replaceLiteralStringByUnicodeArrayTranslatorCall (nodeValue: string): string {
+    protected replaceLiteralStringByUnicodeArrayCall (nodeValue: string): string {
         let value: string = Utils.stringToUnicode(nodeValue),
         let value: string = Utils.stringToUnicode(nodeValue),
             unicodeArray: string[] = this.nodes.get('unicodeArrayNode').getNodeData(),
             unicodeArray: string[] = this.nodes.get('unicodeArrayNode').getNodeData(),
             sameIndex: number = unicodeArray.indexOf(value),
             sameIndex: number = unicodeArray.indexOf(value),
@@ -86,6 +93,10 @@ export abstract class NodeObfuscator implements INodeObfuscator {
 
 
         hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
         hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
 
 
-        return `${this.nodes.get('unicodeArrayTranslator').getNodeIdentifier()}('${hexadecimalIndex}')`;
+        if (this.options['wrapUnicodeArrayCalls']) {
+            return `${this.nodes.get('unicodeArrayCallsWrapper').getNodeIdentifier()}('${hexadecimalIndex}')`;
+        }
+
+        return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${hexadecimalIndex}]`;
     }
     }
 }
 }

+ 1 - 1
tests/dev-test.ts

@@ -1,6 +1,6 @@
 import * as JavaScriptObfuscator from "../index";
 import * as JavaScriptObfuscator from "../index";
 
 
-let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
+let obfuscatedCode: string = (<any>JavaScriptObfuscator).obfuscate(
     `
     `
     (function(){
     (function(){
         var result = 1,
         var result = 1,