selfDefending test implementation

This commit is contained in:
sanex3339
2016-06-04 14:39:11 +03:00
parent 69b624ecdf
commit c8568a11de
4 changed files with 5 additions and 5 deletions
@@ -36,7 +36,7 @@ class UnicodeArrayCallsWrapper extends Node_1.Node {
if (
${keyName} % ${Utils_1.Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
${environmentName}.toString()
${environmentName}[${Utils_1.Utils.stringToUnicode('toString')}]()
) !== true && ${keyName}++
) {
return ${this.unicodeArrayName}[parseInt(${keyName}, 16)]
@@ -34,7 +34,7 @@ class UnicodeArrayDecodeNode extends Node_1.Node {
if (
${indexVariableName} % ${Utils_1.Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
${environmentName}.toString()
${environmentName}[${Utils_1.Utils.stringToUnicode('toString')}]()
) !== true && ${indexVariableName}++
) {
continue;
@@ -96,7 +96,7 @@ export class UnicodeArrayCallsWrapper extends Node {
if (
${keyName} % ${Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
${environmentName}.toString()
${environmentName}[${Utils.stringToUnicode('toString')}]()
) !== true && ${keyName}++
) {
return ${this.unicodeArrayName}[parseInt(${keyName}, 16)]
@@ -78,7 +78,7 @@ export class UnicodeArrayDecodeNode extends Node {
let node: INode,
selfDefendingCode: string = '';
if (this.options['selfDefending']) {
selfDefendingCode = `
var ${environmentName} = function(){return ${Utils.stringToUnicode('dev')};};
@@ -86,7 +86,7 @@ export class UnicodeArrayDecodeNode extends Node {
if (
${indexVariableName} % ${Utils.getRandomInteger(this.unicodeArray.length / 8, this.unicodeArray.length / 2)} === 0 &&
/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/.test(
${environmentName}.toString()
${environmentName}[${Utils.stringToUnicode('toString')}]()
) !== true && ${indexVariableName}++
) {
continue;