Browse Source

literal int number values to hex convert

sanex3339 9 years ago
parent
commit
74aea01aaa

+ 3 - 2
src/node-obfuscators/NodeObfuscator.js

@@ -22,7 +22,7 @@ class NodeObfuscator {
         return `${prefix}${Utils_1.Utils.decToHex(nodeValue)}`;
         return `${prefix}${Utils_1.Utils.decToHex(nodeValue)}`;
     }
     }
     replaceLiteralStringByArrayElement(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) {
         if (sameIndex < 0) {
             index = unicodeArray.length;
             index = unicodeArray.length;
             unicodeArray.push(Utils_1.Utils.stringToUnicode(nodeValue));
             unicodeArray.push(Utils_1.Utils.stringToUnicode(nodeValue));
@@ -30,7 +30,8 @@ class NodeObfuscator {
         else {
         else {
             index = sameIndex;
             index = sameIndex;
         }
         }
-        return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${index}]`;
+        hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
+        return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${hexadecimalIndex}]`;
     }
     }
 }
 }
 exports.NodeObfuscator = NodeObfuscator;
 exports.NodeObfuscator = NodeObfuscator;

+ 5 - 2
src/node-obfuscators/NodeObfuscator.ts

@@ -64,7 +64,8 @@ export abstract class NodeObfuscator implements INodeObfuscator {
         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),
-            index: number;
+            index: number,
+            hexadecimalIndex: string;
 
 
         if (sameIndex < 0) {
         if (sameIndex < 0) {
             index = unicodeArray.length;
             index = unicodeArray.length;
@@ -73,6 +74,8 @@ export abstract class NodeObfuscator implements INodeObfuscator {
             index = sameIndex;
             index = sameIndex;
         }
         }
 
 
-        return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${index}]`;
+        hexadecimalIndex = this.replaceLiteralNumberByHexadecimalValue(index);
+
+        return `${this.nodes.get('unicodeArrayNode').getNodeIdentifier()}[${hexadecimalIndex}]`;
     }
     }
 }
 }