From f4a655e0675f435d86ab23b16268608a83ee6b43 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Mon, 18 Jul 2016 13:19:16 +0300 Subject: [PATCH] moved `custom-nodes` code strings to `templates` folders --- dist/index.js | 150 +++++++++++++++--- .../ConsoleOutputDisableExpressionNode.ts | 19 +-- .../DebugProtectionFunctionNode.ts | 22 +-- .../SelfDefendingUnicodeNode.ts | 14 +- .../UnicodeArrayDecodeNode.ts | 55 +------ .../UnicodeArrayRotateFunctionNode.ts | 39 ++--- src/templates/custom-nodes/AtobTemplate.ts | 25 +++ .../ConsoleOutputDisableExpressionTemplate.ts | 19 +++ .../DebugProtectionFunctionTemplate.ts | 25 +++ .../SelfDefendingTemplate.ts | 16 ++ .../SelfDefendingTemplate.ts | 18 +++ .../UnicodeArrayDecodeTemplate.ts | 35 ++++ .../SelfDefendingTemplate.ts | 16 ++ .../UnicodeArrayRotateFunctionTemplate.ts | 32 ++++ 14 files changed, 354 insertions(+), 131 deletions(-) create mode 100644 src/templates/custom-nodes/AtobTemplate.ts create mode 100644 src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts create mode 100644 src/templates/custom-nodes/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate.ts create mode 100644 src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts create mode 100644 src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/SelfDefendingTemplate.ts create mode 100644 src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/UnicodeArrayDecodeTemplate.ts create mode 100644 src/templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/SelfDefendingTemplate.ts create mode 100644 src/templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/UnicodeArrayRotateFunctionTemplate.ts diff --git a/dist/index.js b/dist/index.js index e655617f..82274f92 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1487,6 +1487,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var AppendState_1 = __webpack_require__(2); +var ConsoleOutputDisableExpressionTemplate_1 = __webpack_require__(62); var Node_1 = __webpack_require__(3); var NodeUtils_1 = __webpack_require__(1); @@ -1516,7 +1517,7 @@ var ConsoleOutputDisableExpressionNode = function (_Node_1$Node) { }, { key: "getNodeStructure", value: function getNodeStructure() { - return NodeUtils_1.NodeUtils.convertCodeToStructure("\n (function () {\n var _ = '(\u0004\u0006\u0003\u0005[]' + '[\"filter\"][\"\u0007tructor\"]' + '(\"return this\")()' + '.' + '\u0003;\u0006\u0002\u0005\u0004};' + '_\u0003.log\u0001.in' + 'fo\u0001.' + 'war' + 'n\u0001.er' + 'r' + 'or\u0001})();' + '\u0001\u0005_\u0002;' + '_\u0003\u0002function' + '\u0003\u0007ole\u0004\u0002 ()' + '{\u0005 = \u0006var ' + '_\u0007cons', \n Y, \n $;\n \n for (Y in $ = \"\u0007\u0006\u0005\u0004\u0003\u0002\u0001\") {\n var arr = _.split($[Y]);\n _ = arr.join(arr.pop());\n }\n \n [][\"filter\"][\"constructor\"](_)();\n })()\n "); + return NodeUtils_1.NodeUtils.convertCodeToStructure(ConsoleOutputDisableExpressionTemplate_1.ConsoleOutputDisableExpressionTemplate()); } }]); @@ -1639,6 +1640,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var AppendState_1 = __webpack_require__(2); +var DebugProtectionFunctionTemplate_1 = __webpack_require__(61); var Node_1 = __webpack_require__(3); var NodeUtils_1 = __webpack_require__(1); var Utils_1 = __webpack_require__(0); @@ -1674,7 +1676,7 @@ var DebugProtectionFunctionNode = function (_Node_1$Node) { }, { key: "getNodeStructure", value: function getNodeStructure() { - return NodeUtils_1.NodeUtils.convertCodeToStructure("\n var " + this.debugProtectionFunctionName + " = function () {\n function debuggerProtection (counter) {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n (function () {}.constructor('debugger')());\n } else {\n [].filter.constructor(" + Utils_1.Utils.stringToJSFuck('debugger') + ")();\n }\n \n debuggerProtection(++counter);\n }\n \n try {\n debuggerProtection(0);\n } catch (y) {}\n };\n "); + return NodeUtils_1.NodeUtils.convertCodeToStructure(DebugProtectionFunctionTemplate_1.DebugProtectionFunctionTemplate(this.debugProtectionFunctionName)); } }]); @@ -1699,8 +1701,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var AppendState_1 = __webpack_require__(2); -var JSFuck_1 = __webpack_require__(9); var NoCustomNodesPreset_1 = __webpack_require__(13); +var SelfDefendingTemplate_1 = __webpack_require__(60); var JavaScriptObfuscator_1 = __webpack_require__(8); var Node_1 = __webpack_require__(3); var NodeUtils_1 = __webpack_require__(1); @@ -1740,7 +1742,7 @@ var SelfDefendingUnicodeNode = function (_Node_1$Node) { }, { key: "getNodeStructure", value: function getNodeStructure() { - return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () { \n var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";},\n func2 = function () {\n return 'window';\n };\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? Function(" + Utils_1.Utils.stringToUnicode("return/(\\\\[x|u](\\w){2,4})+/") + ")().test(func2.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode()); + return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(SelfDefendingTemplate_1.SelfDefendingTemplate(), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode()); } }]); @@ -1835,9 +1837,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var AppendState_1 = __webpack_require__(2); -var JSFuck_1 = __webpack_require__(9); -var NoCustomNodesPreset_1 = __webpack_require__(13); -var JavaScriptObfuscator_1 = __webpack_require__(8); +var SelfDefendingTemplate_1 = __webpack_require__(56); +var UnicodeArrayDecodeTemplate_1 = __webpack_require__(57); var Node_1 = __webpack_require__(3); var NodeUtils_1 = __webpack_require__(1); var Utils_1 = __webpack_require__(0); @@ -1872,17 +1873,14 @@ var UnicodeArrayDecodeNode = function (_Node_1$Node) { }, { key: "getNodeStructure", value: function getNodeStructure() { - var environmentName = Utils_1.Utils.getRandomVariableName(), - forLoopFunctionName = Utils_1.Utils.getRandomVariableName(), - indexVariableName = Utils_1.Utils.getRandomVariableName(), - tempArrayName = Utils_1.Utils.getRandomVariableName(); + var forLoopFunctionName = Utils_1.Utils.getRandomVariableName(); var code = ''; if (this.options.selfDefending) { - code = "\n var " + environmentName + " = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";};\n \n 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 + "){}')() : Function(" + Utils_1.Utils.stringToUnicode('a') + ", atob(" + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + "))(" + forLoopFunctionName + ") ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n "; + code = SelfDefendingTemplate_1.SelfDefendingTemplate(this.unicodeArrayName, forLoopFunctionName); } else { code = forLoopFunctionName + "();"; } - return NodeUtils_1.NodeUtils.convertCodeToStructure("\n (function () {\n " + JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () {\n var object = []['filter']['constructor']('return this')();\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n \n object.atob || (\n object.atob = function(input) {\n var str = String(input).replace(/=+$/, '');\n for (\n var bc = 0, bs, buffer, idx = 0, output = '';\n buffer = str.charAt(idx++);\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode() + "\n \n var " + forLoopFunctionName + " = function () {\n var " + tempArrayName + " = [];\n \n for (var " + indexVariableName + " in " + this.unicodeArrayName + ") {\n " + tempArrayName + "[" + Utils_1.Utils.stringToUnicode('push') + "](decodeURI(atob(" + this.unicodeArrayName + "[" + indexVariableName + "])));\n }\n \n " + this.unicodeArrayName + " = " + tempArrayName + ";\n };\n \n " + code + "\n })();\n "); + return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayDecodeTemplate_1.UnicodeArrayDecodeTemplate(code, this.unicodeArrayName, forLoopFunctionName)); } }]); @@ -1991,8 +1989,9 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var AppendState_1 = __webpack_require__(2); -var JSFuck_1 = __webpack_require__(9); var NoCustomNodesPreset_1 = __webpack_require__(13); +var SelfDefendingTemplate_1 = __webpack_require__(58); +var UnicodeArrayRotateFunctionTemplate_1 = __webpack_require__(59); var JavaScriptObfuscator_1 = __webpack_require__(8); var Node_1 = __webpack_require__(3); var NodeUtils_1 = __webpack_require__(1); @@ -2029,17 +2028,15 @@ var UnicodeArrayRotateFunctionNode = function (_Node_1$Node) { }, { key: "getNodeStructure", value: function getNodeStructure() { - var arrayName = Utils_1.Utils.getRandomVariableName(), - code = '', + var code = '', timesName = Utils_1.Utils.getRandomVariableName(), - timesArgumentName = Utils_1.Utils.getRandomVariableName(), whileFunctionName = Utils_1.Utils.getRandomVariableName(); if (this.options.selfDefending) { - code = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () {\n var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";};\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : Function(" + Utils_1.Utils.stringToUnicode('a') + ", " + Utils_1.Utils.stringToUnicode('b') + ", " + Utils_1.Utils.stringToUnicode('a(++b)') + ")(" + whileFunctionName + ", " + timesName + ") ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode(); + code = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(SelfDefendingTemplate_1.SelfDefendingTemplate(whileFunctionName, timesName), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode(); } else { code = whileFunctionName + "(++" + timesName + ")"; } - return NodeUtils_1.NodeUtils.convertCodeToStructure("\n (function (" + arrayName + ", " + timesName + ") {\n var " + whileFunctionName + " = function (" + timesArgumentName + ") {\n while (--" + timesArgumentName + ") {\n " + arrayName + "[" + Utils_1.Utils.stringToUnicode('push') + "](" + arrayName + "[" + Utils_1.Utils.stringToUnicode('shift') + "]());\n }\n };\n \n " + code + "\n })(" + this.unicodeArrayName + ", 0x" + Utils_1.Utils.decToHex(this.unicodeArrayRotateValue) + ");\n "); + return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayRotateFunctionTemplate_1.UnicodeArrayRotateFunctionTemplate(code, this.unicodeArrayName, this.unicodeArrayRotateValue, whileFunctionName, timesName)); } }]); @@ -2885,6 +2882,121 @@ if (!global._babelPolyfill) { } module.exports = JavaScriptObfuscator_1.JavaScriptObfuscator; +/***/ }, +/* 53 */, +/* 54 */, +/* 55 */ +/***/ function(module, exports) { + +"use strict"; +"use strict"; + +function AtobTemplate() { + return "\n (function () {\n var object = []['filter']['constructor']('return this')();\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n object.atob || (\n object.atob = function(input) {\n var str = String(input).replace(/=+$/, '');\n for (\n var bc = 0, bs, buffer, idx = 0, output = '';\n buffer = str.charAt(idx++);\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n "; +} +exports.AtobTemplate = AtobTemplate; + +/***/ }, +/* 56 */ +/***/ function(module, exports, __webpack_require__) { + +"use strict"; +"use strict"; + +var JSFuck_1 = __webpack_require__(9); +var Utils_1 = __webpack_require__(0); +function SelfDefendingTemplate(unicodeArrayName, forLoopFunctionName) { + var environmentName = Utils_1.Utils.getRandomVariableName(); + return "\n var " + environmentName + " = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";};\n \n Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")()[" + Utils_1.Utils.stringToUnicode('test') + "](" + environmentName + "[" + Utils_1.Utils.stringToUnicode('toString') + "]()) !== " + JSFuck_1.JSFuck.True + " && !" + unicodeArrayName + "++ ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : Function(" + Utils_1.Utils.stringToUnicode('a') + ", atob(" + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + "))(" + forLoopFunctionName + ") ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n "; +} +exports.SelfDefendingTemplate = SelfDefendingTemplate; + +/***/ }, +/* 57 */ +/***/ function(module, exports, __webpack_require__) { + +"use strict"; +"use strict"; + +var NoCustomNodesPreset_1 = __webpack_require__(13); +var AtobTemplate_1 = __webpack_require__(55); +var JavaScriptObfuscator_1 = __webpack_require__(8); +var Utils_1 = __webpack_require__(0); +function UnicodeArrayDecodeTemplate(code, unicodeArrayName, forLoopFunctionName) { + var indexVariableName = Utils_1.Utils.getRandomVariableName(), + tempArrayName = Utils_1.Utils.getRandomVariableName(); + return "\n (function () {\n " + JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(AtobTemplate_1.AtobTemplate(), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode() + "\n \n var " + forLoopFunctionName + " = function () {\n var " + tempArrayName + " = [];\n \n for (var " + indexVariableName + " in " + unicodeArrayName + ") {\n " + tempArrayName + "[" + Utils_1.Utils.stringToUnicode('push') + "](decodeURI(atob(" + unicodeArrayName + "[" + indexVariableName + "])));\n }\n \n " + unicodeArrayName + " = " + tempArrayName + ";\n };\n \n " + code + "\n })();\n "; +} +exports.UnicodeArrayDecodeTemplate = UnicodeArrayDecodeTemplate; + +/***/ }, +/* 58 */ +/***/ function(module, exports, __webpack_require__) { + +"use strict"; +"use strict"; + +var JSFuck_1 = __webpack_require__(9); +var Utils_1 = __webpack_require__(0); +function SelfDefendingTemplate(whileFunctionName, timesName) { + return "(function () {\n var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";};\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : Function(" + Utils_1.Utils.stringToUnicode('a') + ", " + Utils_1.Utils.stringToUnicode('b') + ", " + Utils_1.Utils.stringToUnicode('a(++b)') + ")(" + whileFunctionName + ", " + timesName + ") ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();"; +} +exports.SelfDefendingTemplate = SelfDefendingTemplate; + +/***/ }, +/* 59 */ +/***/ function(module, exports, __webpack_require__) { + +"use strict"; +"use strict"; + +var Utils_1 = __webpack_require__(0); +function UnicodeArrayRotateFunctionTemplate(code, unicodeArrayName, unicodeArrayRotateValue, whileFunctionName, timesName) { + var arrayName = Utils_1.Utils.getRandomVariableName(), + timesArgumentName = Utils_1.Utils.getRandomVariableName(); + return "\n (function (" + arrayName + ", " + timesName + ") {\n var " + whileFunctionName + " = function (" + timesArgumentName + ") {\n while (--" + timesArgumentName + ") {\n " + arrayName + "[" + Utils_1.Utils.stringToUnicode('push') + "](" + arrayName + "[" + Utils_1.Utils.stringToUnicode('shift') + "]());\n }\n };\n \n " + code + "\n })(" + unicodeArrayName + ", 0x" + Utils_1.Utils.decToHex(unicodeArrayRotateValue) + ");\n "; +} +exports.UnicodeArrayRotateFunctionTemplate = UnicodeArrayRotateFunctionTemplate; + +/***/ }, +/* 60 */ +/***/ function(module, exports, __webpack_require__) { + +"use strict"; +"use strict"; + +var JSFuck_1 = __webpack_require__(9); +var Utils_1 = __webpack_require__(0); +function SelfDefendingTemplate() { + return "\n (function () { \n var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";},\n func2 = function () {\n return 'window';\n };\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? Function(" + Utils_1.Utils.stringToUnicode("return/(\\\\[x|u](\\w){2,4})+/") + ")().test(func2.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();\n "; +} +exports.SelfDefendingTemplate = SelfDefendingTemplate; + +/***/ }, +/* 61 */ +/***/ function(module, exports, __webpack_require__) { + +"use strict"; +"use strict"; + +var Utils_1 = __webpack_require__(0); +function DebugProtectionFunctionTemplate(debugProtectionFunctionName) { + return "\n var " + debugProtectionFunctionName + " = function () {\n function debuggerProtection (counter) {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n (function () {}.constructor('debugger')());\n } else {\n [].filter.constructor(" + Utils_1.Utils.stringToJSFuck('debugger') + ")();\n }\n \n debuggerProtection(++counter);\n }\n \n try {\n debuggerProtection(0);\n } catch (y) {}\n };\n "; +} +exports.DebugProtectionFunctionTemplate = DebugProtectionFunctionTemplate; + +/***/ }, +/* 62 */ +/***/ function(module, exports) { + +"use strict"; +"use strict"; + +function ConsoleOutputDisableExpressionTemplate() { + return "\n (function () {\n var _ = '(\u0004\u0006\u0003\u0005[]' + '[\"filter\"][\"\u0007tructor\"]' + '(\"return this\")()' + '.' + '\u0003;\u0006\u0002\u0005\u0004};' + '_\u0003.log\u0001.in' + 'fo\u0001.' + 'war' + 'n\u0001.er' + 'r' + 'or\u0001})();' + '\u0001\u0005_\u0002;' + '_\u0003\u0002function' + '\u0003\u0007ole\u0004\u0002 ()' + '{\u0005 = \u0006var ' + '_\u0007cons', \n Y, \n $;\n \n for (Y in $ = \"\u0007\u0006\u0005\u0004\u0003\u0002\u0001\") {\n var arr = _.split($[Y]);\n _ = arr.join(arr.pop());\n }\n \n [][\"filter\"][\"constructor\"](_)();\n })()\n "; +} +exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate; + /***/ } /******/ ]); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts b/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts index 3b0283d6..de979e16 100644 --- a/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts +++ b/src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts @@ -4,6 +4,8 @@ import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement"; import { AppendState } from "../../enums/AppendState"; +import { ConsoleOutputDisableExpressionTemplate } from "../../templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate"; + import { Node } from '../Node'; import { NodeUtils } from "../../NodeUtils"; @@ -37,19 +39,8 @@ export class ConsoleOutputDisableExpressionNode extends Node { * @returns {INode} */ protected getNodeStructure (): INode { - return NodeUtils.convertCodeToStructure(` - (function () { - var _ = '(\u0004\u0006\u0003\u0005[]' + '["filter"]["\u0007tructor"]' + '("return this")()' + '.' + '\u0003;\u0006\u0002\u0005\u0004};' + '_\u0003.log\u0001.in' + 'fo\u0001.' + 'war' + 'n\u0001.er' + 'r' + 'or\u0001})();' + '\u0001\u0005_\u0002;' + '_\u0003\u0002function' + '\u0003\u0007ole\u0004\u0002 ()' + '{\u0005 = \u0006var ' + '_\u0007cons', - Y, - $; - - for (Y in $ = "\u0007\u0006\u0005\u0004\u0003\u0002\u0001") { - var arr = _.split($[Y]); - _ = arr.join(arr.pop()); - } - - []["filter"]["constructor"](_)(); - })() - `); + return NodeUtils.convertCodeToStructure( + ConsoleOutputDisableExpressionTemplate() + ); } } diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts index d67eab5e..25e1fb45 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts @@ -5,6 +5,8 @@ import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement"; import { AppendState } from "../../enums/AppendState"; +import { DebugProtectionFunctionTemplate } from "../../templates/custom-nodes/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate"; + import { Node } from '../Node'; import { NodeUtils } from '../../NodeUtils'; import { Utils } from "../../Utils"; @@ -56,22 +58,8 @@ export class DebugProtectionFunctionNode extends Node { * @returns {INode} */ protected getNodeStructure (): INode { - return NodeUtils.convertCodeToStructure(` - var ${this.debugProtectionFunctionName} = function () { - function debuggerProtection (counter) { - if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) { - (function () {}.constructor('debugger')()); - } else { - [].filter.constructor(${Utils.stringToJSFuck('debugger')})(); - } - - debuggerProtection(++counter); - } - - try { - debuggerProtection(0); - } catch (y) {} - }; - `); + return NodeUtils.convertCodeToStructure( + DebugProtectionFunctionTemplate(this.debugProtectionFunctionName) + ); } } diff --git a/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts b/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts index 0bc9be25..a7d24d48 100644 --- a/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts +++ b/src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts @@ -3,10 +3,11 @@ import { INode } from "../../interfaces/nodes/INode"; import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement"; import { AppendState } from "../../enums/AppendState"; -import { JSFuck } from "../../enums/JSFuck"; import { NO_CUSTOM_NODES_PRESET } from "../../preset-options/NoCustomNodesPreset"; +import { SelfDefendingTemplate } from "../../templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate"; + import { JavaScriptObfuscator } from "../../JavaScriptObfuscator"; import { Node } from '../Node'; import { NodeUtils } from "../../NodeUtils"; @@ -40,16 +41,7 @@ export class SelfDefendingUnicodeNode extends Node { */ protected getNodeStructure (): INode { return NodeUtils.convertCodeToStructure( - JavaScriptObfuscator.obfuscate(` - (function () { - var func = function(){return ${Utils.stringToUnicode('dev')};}, - func2 = function () { - return 'window'; - }; - - !Function(${Utils.stringToUnicode(`return/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/`)})().test(func.toString()) ? Function(${Utils.stringToUnicode(`return/(\\\\[x|u](\\w){2,4})+/`)})().test(func2.toString()) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.True}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')(); - })(); - `, NO_CUSTOM_NODES_PRESET).getObfuscatedCode() + JavaScriptObfuscator.obfuscate(SelfDefendingTemplate(), NO_CUSTOM_NODES_PRESET).getObfuscatedCode() ); } } diff --git a/src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts b/src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts index f023275b..f44b4c05 100644 --- a/src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts +++ b/src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts @@ -5,11 +5,10 @@ import { IOptions } from "../../interfaces/IOptions"; import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement"; import { AppendState } from "../../enums/AppendState"; -import { JSFuck } from "../../enums/JSFuck"; -import { NO_CUSTOM_NODES_PRESET } from "../../preset-options/NoCustomNodesPreset"; +import { SelfDefendingTemplate } from "../../templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/SelfDefendingTemplate"; +import { UnicodeArrayDecodeTemplate } from "../../templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/UnicodeArrayDecodeTemplate"; -import { JavaScriptObfuscator } from '../../JavaScriptObfuscator'; import { Node } from '../Node'; import { NodeUtils } from "../../NodeUtils"; import { Utils } from "../../Utils"; @@ -68,58 +67,18 @@ export class UnicodeArrayDecodeNode extends Node { * @returns {INode} */ protected getNodeStructure (): INode { - const environmentName: string = Utils.getRandomVariableName(), - forLoopFunctionName: string = Utils.getRandomVariableName(), - indexVariableName: string = Utils.getRandomVariableName(), - tempArrayName: string = Utils.getRandomVariableName(); + const forLoopFunctionName: string = Utils.getRandomVariableName(); let code: string = ''; if (this.options.selfDefending) { - code = ` - var ${environmentName} = function(){return ${Utils.stringToUnicode('dev')};}; - - Function(${Utils.stringToUnicode(`return/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/`)})()[${Utils.stringToUnicode('test')}](${environmentName}[${Utils.stringToUnicode('toString')}]()) !== ${JSFuck.True} && !${this.unicodeArrayName}++ ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.True}){}')() : Function(${Utils.stringToUnicode('a')}, atob(${Utils.stringToUnicode(Utils.btoa('a.call()'))}))(${forLoopFunctionName}) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')(); - `; + code = SelfDefendingTemplate(this.unicodeArrayName, forLoopFunctionName); } else { code = `${forLoopFunctionName}();`; } - return NodeUtils.convertCodeToStructure(` - (function () { - ${JavaScriptObfuscator.obfuscate(` - (function () { - var object = []['filter']['constructor']('return this')(); - var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - - object.atob || ( - object.atob = function(input) { - var str = String(input).replace(/=+$/, ''); - for ( - var bc = 0, bs, buffer, idx = 0, output = ''; - buffer = str.charAt(idx++); - ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, - bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 - ) { - buffer = chars.indexOf(buffer); - } - return output; - }); - })(); - `, NO_CUSTOM_NODES_PRESET).getObfuscatedCode()} - - var ${forLoopFunctionName} = function () { - var ${tempArrayName} = []; - - for (var ${indexVariableName} in ${this.unicodeArrayName}) { - ${tempArrayName}[${Utils.stringToUnicode('push')}](decodeURI(atob(${this.unicodeArrayName}[${indexVariableName}]))); - } - - ${this.unicodeArrayName} = ${tempArrayName}; - }; - - ${code} - })(); - `); + return NodeUtils.convertCodeToStructure( + UnicodeArrayDecodeTemplate(code, this.unicodeArrayName, forLoopFunctionName) + ); } } diff --git a/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts b/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts index aaad409c..303bbbe2 100644 --- a/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts +++ b/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts @@ -4,10 +4,12 @@ import { IOptions } from "../../interfaces/IOptions"; import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement"; import { AppendState } from "../../enums/AppendState"; -import { JSFuck } from "../../enums/JSFuck"; import { NO_CUSTOM_NODES_PRESET } from "../../preset-options/NoCustomNodesPreset"; +import { SelfDefendingTemplate } from "../../templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/SelfDefendingTemplate"; +import { UnicodeArrayRotateFunctionTemplate } from "../../templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/UnicodeArrayRotateFunctionTemplate"; + import { JavaScriptObfuscator } from "../../JavaScriptObfuscator"; import { Node } from '../Node'; import { NodeUtils } from "../../NodeUtils"; @@ -75,34 +77,27 @@ export class UnicodeArrayRotateFunctionNode extends Node { * @returns {INode} */ protected getNodeStructure (): INode { - let arrayName: string = Utils.getRandomVariableName(), - code: string = '', + let code: string = '', timesName: string = Utils.getRandomVariableName(), - timesArgumentName: string = Utils.getRandomVariableName(), whileFunctionName: string = Utils.getRandomVariableName(); if (this.options.selfDefending) { - code = JavaScriptObfuscator.obfuscate(` - (function () { - var func = function(){return ${Utils.stringToUnicode('dev')};}; - - !Function(${Utils.stringToUnicode(`return/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/`)})().test(func.toString()) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.True}){}')() : Function(${Utils.stringToUnicode('a')}, ${Utils.stringToUnicode('b')}, ${Utils.stringToUnicode('a(++b)')})(${whileFunctionName}, ${timesName}) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')(); - })(); - `, NO_CUSTOM_NODES_PRESET).getObfuscatedCode(); + code = JavaScriptObfuscator.obfuscate( + SelfDefendingTemplate(whileFunctionName, timesName), + NO_CUSTOM_NODES_PRESET + ).getObfuscatedCode(); } else { code = `${whileFunctionName}(++${timesName})`; } - return NodeUtils.convertCodeToStructure(` - (function (${arrayName}, ${timesName}) { - var ${whileFunctionName} = function (${timesArgumentName}) { - while (--${timesArgumentName}) { - ${arrayName}[${Utils.stringToUnicode('push')}](${arrayName}[${Utils.stringToUnicode('shift')}]()); - } - }; - - ${code} - })(${this.unicodeArrayName}, 0x${Utils.decToHex(this.unicodeArrayRotateValue)}); - `); + return NodeUtils.convertCodeToStructure( + UnicodeArrayRotateFunctionTemplate( + code, + this.unicodeArrayName, + this.unicodeArrayRotateValue, + whileFunctionName, + timesName + ) + ); } } diff --git a/src/templates/custom-nodes/AtobTemplate.ts b/src/templates/custom-nodes/AtobTemplate.ts new file mode 100644 index 00000000..a0d6c23f --- /dev/null +++ b/src/templates/custom-nodes/AtobTemplate.ts @@ -0,0 +1,25 @@ +/** + * @returns {string} + */ +export function AtobTemplate (): string { + return ` + (function () { + var object = []['filter']['constructor']('return this')(); + var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + + object.atob || ( + object.atob = function(input) { + var str = String(input).replace(/=+$/, ''); + for ( + var bc = 0, bs, buffer, idx = 0, output = ''; + buffer = str.charAt(idx++); + ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, + bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 + ) { + buffer = chars.indexOf(buffer); + } + return output; + }); + })(); + `; +} diff --git a/src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts b/src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts new file mode 100644 index 00000000..93d1b9fc --- /dev/null +++ b/src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts @@ -0,0 +1,19 @@ +/** + * @returns {string} + */ +export function ConsoleOutputDisableExpressionTemplate (): string { + return ` + (function () { + var _ = '(\u0004\u0006\u0003\u0005[]' + '["filter"]["\u0007tructor"]' + '("return this")()' + '.' + '\u0003;\u0006\u0002\u0005\u0004};' + '_\u0003.log\u0001.in' + 'fo\u0001.' + 'war' + 'n\u0001.er' + 'r' + 'or\u0001})();' + '\u0001\u0005_\u0002;' + '_\u0003\u0002function' + '\u0003\u0007ole\u0004\u0002 ()' + '{\u0005 = \u0006var ' + '_\u0007cons', + Y, + $; + + for (Y in $ = "\u0007\u0006\u0005\u0004\u0003\u0002\u0001") { + var arr = _.split($[Y]); + _ = arr.join(arr.pop()); + } + + []["filter"]["constructor"](_)(); + })() + `; +} diff --git a/src/templates/custom-nodes/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate.ts b/src/templates/custom-nodes/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate.ts new file mode 100644 index 00000000..547549aa --- /dev/null +++ b/src/templates/custom-nodes/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate.ts @@ -0,0 +1,25 @@ +import { Utils } from "../../../../Utils"; + +/** + * @param debugProtectionFunctionName + * @returns {string} + */ +export function DebugProtectionFunctionTemplate (debugProtectionFunctionName: string): string { + return ` + var ${debugProtectionFunctionName} = function () { + function debuggerProtection (counter) { + if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) { + (function () {}.constructor('debugger')()); + } else { + [].filter.constructor(${Utils.stringToJSFuck('debugger')})(); + } + + debuggerProtection(++counter); + } + + try { + debuggerProtection(0); + } catch (y) {} + }; + `; +} diff --git a/src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts b/src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts new file mode 100644 index 00000000..87f8739e --- /dev/null +++ b/src/templates/custom-nodes/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts @@ -0,0 +1,16 @@ +import { JSFuck } from "../../../../enums/JSFuck"; + +import { Utils } from "../../../../Utils"; + +export function SelfDefendingTemplate (): string { + return ` + (function () { + var func = function(){return ${Utils.stringToUnicode('dev')};}, + func2 = function () { + return 'window'; + }; + + !Function(${Utils.stringToUnicode(`return/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/`)})().test(func.toString()) ? Function(${Utils.stringToUnicode(`return/(\\\\[x|u](\\w){2,4})+/`)})().test(func2.toString()) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.True}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')(); + })(); + `; +} diff --git a/src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/SelfDefendingTemplate.ts b/src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/SelfDefendingTemplate.ts new file mode 100644 index 00000000..73add545 --- /dev/null +++ b/src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/SelfDefendingTemplate.ts @@ -0,0 +1,18 @@ +import { JSFuck } from "../../../../enums/JSFuck"; + +import { Utils } from "../../../../Utils"; + +/** + * @param unicodeArrayName + * @param forLoopFunctionName + * @returns {string} + */ +export function SelfDefendingTemplate (unicodeArrayName: string, forLoopFunctionName: string): string { + let environmentName: string = Utils.getRandomVariableName(); + + return ` + var ${environmentName} = function(){return ${Utils.stringToUnicode('dev')};}; + + Function(${Utils.stringToUnicode(`return/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/`)})()[${Utils.stringToUnicode('test')}](${environmentName}[${Utils.stringToUnicode('toString')}]()) !== ${JSFuck.True} && !${unicodeArrayName}++ ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.True}){}')() : Function(${Utils.stringToUnicode('a')}, atob(${Utils.stringToUnicode(Utils.btoa('a.call()'))}))(${forLoopFunctionName}) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')(); + `; +} diff --git a/src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/UnicodeArrayDecodeTemplate.ts b/src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/UnicodeArrayDecodeTemplate.ts new file mode 100644 index 00000000..0dc9e7a3 --- /dev/null +++ b/src/templates/custom-nodes/unicode-array-nodes/unicode-array-decode-node/UnicodeArrayDecodeTemplate.ts @@ -0,0 +1,35 @@ +import { NO_CUSTOM_NODES_PRESET } from "../../../../preset-options/NoCustomNodesPreset"; + +import { AtobTemplate } from "../../AtobTemplate"; + +import { JavaScriptObfuscator } from '../../../../JavaScriptObfuscator'; +import { Utils } from "../../../../Utils"; + +/** + * @param code + * @param unicodeArrayName + * @param forLoopFunctionName + * @returns {string} + */ +export function UnicodeArrayDecodeTemplate (code: string, unicodeArrayName: string, forLoopFunctionName: string): string { + let indexVariableName: string = Utils.getRandomVariableName(), + tempArrayName: string = Utils.getRandomVariableName(); + + return ` + (function () { + ${JavaScriptObfuscator.obfuscate(AtobTemplate(), NO_CUSTOM_NODES_PRESET).getObfuscatedCode()} + + var ${forLoopFunctionName} = function () { + var ${tempArrayName} = []; + + for (var ${indexVariableName} in ${unicodeArrayName}) { + ${tempArrayName}[${Utils.stringToUnicode('push')}](decodeURI(atob(${unicodeArrayName}[${indexVariableName}]))); + } + + ${unicodeArrayName} = ${tempArrayName}; + }; + + ${code} + })(); + `; +} diff --git a/src/templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/SelfDefendingTemplate.ts b/src/templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/SelfDefendingTemplate.ts new file mode 100644 index 00000000..4a2be9c1 --- /dev/null +++ b/src/templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/SelfDefendingTemplate.ts @@ -0,0 +1,16 @@ +import { JSFuck } from "../../../../enums/JSFuck"; + +import { Utils } from "../../../../Utils"; + +/** + * @param whileFunctionName + * @param timesName + * @returns {string} + */ +export function SelfDefendingTemplate (whileFunctionName: string, timesName: string): string { + return `(function () { + var func = function(){return ${Utils.stringToUnicode('dev')};}; + + !Function(${Utils.stringToUnicode(`return/\\w+ *\\(\\) *{\\w+ *['|"].+['|"];? *}/`)})().test(func.toString()) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.True}){}')() : Function(${Utils.stringToUnicode('a')}, ${Utils.stringToUnicode('b')}, ${Utils.stringToUnicode('a(++b)')})(${whileFunctionName}, ${timesName}) ? []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')() : []['filter']['constructor'](${Utils.stringToJSFuck('while')} + '(${JSFuck.False}){}')(); + })();`; +} diff --git a/src/templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/UnicodeArrayRotateFunctionTemplate.ts b/src/templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/UnicodeArrayRotateFunctionTemplate.ts new file mode 100644 index 00000000..189e7466 --- /dev/null +++ b/src/templates/custom-nodes/unicode-array-nodes/unicode-array-rotate-function-node/UnicodeArrayRotateFunctionTemplate.ts @@ -0,0 +1,32 @@ +import { Utils } from "../../../../Utils"; + +/** + * @param code + * @param unicodeArrayName + * @param unicodeArrayRotateValue + * @param whileFunctionName + * @param timesName + * @returns {string} + */ +export function UnicodeArrayRotateFunctionTemplate ( + code: string, + unicodeArrayName: string, + unicodeArrayRotateValue: number, + whileFunctionName: string, + timesName: string +): string { + let arrayName: string = Utils.getRandomVariableName(), + timesArgumentName: string = Utils.getRandomVariableName(); + + return ` + (function (${arrayName}, ${timesName}) { + var ${whileFunctionName} = function (${timesArgumentName}) { + while (--${timesArgumentName}) { + ${arrayName}[${Utils.stringToUnicode('push')}](${arrayName}[${Utils.stringToUnicode('shift')}]()); + } + }; + + ${code} + })(${unicodeArrayName}, 0x${Utils.decToHex(unicodeArrayRotateValue)}); + `; +}