Browse Source

`unicodeArrayThreshold` fix

sanex3339 9 năm trước cách đây
mục cha
commit
1d7b7f8d3c

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

@@ -35,7 +35,7 @@ class NodeObfuscator {
         return `${prefix}${Utils_1.Utils.decToHex(nodeValue)}`;
     }
     replaceLiteralValueByUnicodeValue(nodeValue) {
-        let value = nodeValue, replaceByUnicodeArrayFlag = Math.random() > this.options['unicodeArrayThreshold'];
+        let value = nodeValue, replaceByUnicodeArrayFlag = Math.random() <= this.options['unicodeArrayThreshold'];
         if (this.options['encodeUnicodeLiterals'] && replaceByUnicodeArrayFlag) {
             value = new Buffer(encodeURI(value)).toString('base64');
         }

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

@@ -98,7 +98,7 @@ export abstract class NodeObfuscator implements INodeObfuscator {
      */
     protected replaceLiteralValueByUnicodeValue (nodeValue: string): string {
         let value: string = nodeValue,
-            replaceByUnicodeArrayFlag: boolean = Math.random() > this.options['unicodeArrayThreshold'];
+            replaceByUnicodeArrayFlag: boolean = Math.random() <= this.options['unicodeArrayThreshold'];
 
         if (this.options['encodeUnicodeLiterals'] && replaceByUnicodeArrayFlag) {
             value = new Buffer(encodeURI(value)).toString('base64');