diff --git a/src/node-obfuscators/NodeObfuscator.js b/src/node-obfuscators/NodeObfuscator.js index a250537e..b5e8ef48 100644 --- a/src/node-obfuscators/NodeObfuscator.js +++ b/src/node-obfuscators/NodeObfuscator.js @@ -22,7 +22,7 @@ class NodeObfuscator { return `${prefix}${Utils_1.Utils.decToHex(nodeValue)}`; } replaceLiteralStringByArrayElement(nodeValue) { - let value = Utils_1.Utils.stringToUnicode(nodeValue), unicodeArray = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex = unicodeArray.indexOf(value), index; + let value = Utils_1.Utils.stringToUnicode(nodeValue), unicodeArray = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex = unicodeArray.indexOf(value), index, hexadecimalIndex; if (sameIndex < 0) { index = unicodeArray.length; unicodeArray.push(Utils_1.Utils.stringToUnicode(nodeValue)); @@ -30,7 +30,8 @@ class NodeObfuscator { else { index = sameIndex; } - return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${index}]`; + hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index); + return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${hexadecimalIndex}]`; } } exports.NodeObfuscator = NodeObfuscator; diff --git a/src/node-obfuscators/NodeObfuscator.ts b/src/node-obfuscators/NodeObfuscator.ts index 83537e98..f607fdb1 100644 --- a/src/node-obfuscators/NodeObfuscator.ts +++ b/src/node-obfuscators/NodeObfuscator.ts @@ -64,7 +64,8 @@ export abstract class NodeObfuscator implements INodeObfuscator { let value: string = Utils.stringToUnicode(nodeValue), unicodeArray: string[] = this.nodes.get('unicodeArrayNode').getNodeData(), sameIndex: number = unicodeArray.indexOf(value), - index: number; + index: number, + hexadecimalIndex: string; if (sameIndex < 0) { index = unicodeArray.length; @@ -73,6 +74,8 @@ export abstract class NodeObfuscator implements INodeObfuscator { index = sameIndex; } - return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${index}]`; + hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index); + + return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${hexadecimalIndex}]`; } }