Преглед на файлове

selfDefending test implementation

sanex3339 преди 9 години
родител
ревизия
c8568a11de

+ 1 - 1
dist/src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.js

@@ -36,7 +36,7 @@ class UnicodeArrayCallsWrapper extends Node_1.Node {
                 if (
                 if (
                     ${keyName} % ${Utils_1.Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
                     ${keyName} % ${Utils_1.Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
                     /\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
                     /\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
-                        ${environmentName}.toString()
+                        ${environmentName}[${Utils_1.Utils.stringToUnicode('toString')}]()
                     ) !== true && ${keyName}++
                     ) !== true && ${keyName}++
                 ) {
                 ) {
                     return ${this.unicodeArrayName}[parseInt(${keyName}, 16)]
                     return ${this.unicodeArrayName}[parseInt(${keyName}, 16)]

+ 1 - 1
dist/src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.js

@@ -34,7 +34,7 @@ class UnicodeArrayDecodeNode extends Node_1.Node {
                 if (
                 if (
                     ${indexVariableName} % ${Utils_1.Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
                     ${indexVariableName} % ${Utils_1.Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
                     /\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
                     /\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
-                        ${environmentName}.toString()
+                        ${environmentName}[${Utils_1.Utils.stringToUnicode('toString')}]()
                     ) !== true && ${indexVariableName}++
                     ) !== true && ${indexVariableName}++
                 ) {
                 ) {
                     continue;
                     continue;

+ 1 - 1
src/custom-nodes/unicode-array-nodes/UnicodeArrayCallsWrapper.ts

@@ -96,7 +96,7 @@ export class UnicodeArrayCallsWrapper extends Node {
                 if (
                 if (
                     ${keyName} % ${Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
                     ${keyName} % ${Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
                     /\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
                     /\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
-                        ${environmentName}.toString()
+                        ${environmentName}[${Utils.stringToUnicode('toString')}]()
                     ) !== true && ${keyName}++
                     ) !== true && ${keyName}++
                 ) {
                 ) {
                     return ${this.unicodeArrayName}[parseInt(${keyName}, 16)]
                     return ${this.unicodeArrayName}[parseInt(${keyName}, 16)]

+ 2 - 2
src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts

@@ -78,7 +78,7 @@ export class UnicodeArrayDecodeNode extends Node {
 
 
         let node: INode,
         let node: INode,
             selfDefendingCode: string = '';
             selfDefendingCode: string = '';
-        
+
         if (this.options['selfDefending']) {
         if (this.options['selfDefending']) {
             selfDefendingCode = `
             selfDefendingCode = `
                 var ${environmentName} = function(){return ${Utils.stringToUnicode('dev')};};
                 var ${environmentName} = function(){return ${Utils.stringToUnicode('dev')};};
@@ -86,7 +86,7 @@ export class UnicodeArrayDecodeNode extends Node {
                 if (
                 if (
                     ${indexVariableName} % ${Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
                     ${indexVariableName} % ${Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
                     /\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
                     /\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
-                        ${environmentName}.toString()
+                        ${environmentName}[${Utils.stringToUnicode('toString')}]()
                     ) !== true && ${indexVariableName}++
                     ) !== true && ${indexVariableName}++
                 ) {
                 ) {
                     continue;
                     continue;