mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
selfDefending test implementation
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user