فهرست منبع

`unicodeArrayThreshold` fix

sanex3339 9 سال پیش
والد
کامیت
1d7b7f8d3c
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      dist/src/node-obfuscators/NodeObfuscator.js
  2. 1 1
      src/node-obfuscators/NodeObfuscator.ts

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

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