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:
@@ -23,7 +23,7 @@ class SelfDefendingUnicodeNode extends Node_1.Node {
|
||||
getNodeStructure() {
|
||||
let node = esprima.parse(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(`
|
||||
(function () {
|
||||
var func = function(){return ${Utils_1.Utils.stringToUnicode('dev')};},
|
||||
var func = function(){return ${Utils_1.Utils.stringToUnicode('dev')};},
|
||||
func2 = function () {
|
||||
return 'window';
|
||||
};
|
||||
|
||||
@@ -35,6 +35,9 @@ class UnicodeArrayDecodeNode extends Node_1.Node {
|
||||
Function(${Utils_1.Utils.stringToUnicode(`return/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/`)})()[${Utils_1.Utils.stringToUnicode('test')}](${environmentName}[${Utils_1.Utils.stringToUnicode('toString')}]()) !== ${JSFuck_1.JSFuck.True} && !${this.unicodeArrayName}++ ? []['filter']['constructor'](${Utils_1.Utils.stringToJSFuck('while')} + '(${JSFuck_1.JSFuck.True}){}')() : ${JSFuck_1.JSFuck.Window}.eval(${forLoopFunctionName}()) ? []['filter']['constructor'](${Utils_1.Utils.stringToJSFuck('while')} + '(${JSFuck_1.JSFuck.False}){}')() : []['filter']['constructor'](${Utils_1.Utils.stringToJSFuck('while')} + '(${JSFuck_1.JSFuck.False}){}')();
|
||||
`;
|
||||
}
|
||||
else {
|
||||
code = `${forLoopFunctionName}();`;
|
||||
}
|
||||
node = esprima.parse(`
|
||||
(function () {
|
||||
${JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(`
|
||||
|
||||
Vendored
+2
-1
@@ -48,7 +48,8 @@ let obfuscatedCode = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(`
|
||||
})();
|
||||
`, {
|
||||
disableConsoleOutput: false,
|
||||
encodeUnicodeLiterals: true
|
||||
encodeUnicodeLiterals: true,
|
||||
selfDefending: false
|
||||
});
|
||||
console.log(obfuscatedCode);
|
||||
console.log(eval(obfuscatedCode));
|
||||
|
||||
@@ -87,6 +87,8 @@ export class UnicodeArrayDecodeNode extends Node {
|
||||
|
||||
Function(${Utils.stringToUnicode(`return/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/`)})()[${Utils.stringToUnicode('test')}](${environmentName}[${Utils.stringToUnicode('toString')}]()) !== ${JSFuck.True} && !${this.unicodeArrayName}++ ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.True}){}')() : ${JSFuck.Window}.eval(${forLoopFunctionName}()) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')();
|
||||
`;
|
||||
} else {
|
||||
code = `${forLoopFunctionName}();`;
|
||||
}
|
||||
|
||||
node = esprima.parse(`
|
||||
|
||||
+2
-1
@@ -50,7 +50,8 @@ let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
|
||||
`,
|
||||
{
|
||||
disableConsoleOutput: false,
|
||||
encodeUnicodeLiterals: true
|
||||
encodeUnicodeLiterals: true,
|
||||
selfDefending: false
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user