ConsoleOutputDisableExpressionTemplate rewrite

This commit is contained in:
sanex3339
2016-11-06 20:42:44 +03:00
parent c89a9202c9
commit dd410f4703
5 changed files with 21 additions and 26 deletions
+4 -4
View File
@@ -2759,7 +2759,7 @@ var UnicodeArrayNodesGroup = function (_AbstractNodesGroup_) {
_this.appendState = AppendState_1.AppendState.AfterObfuscation;
_this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
_this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
_this.unicodeArrayCallsWrapper = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
return _this;
}
@@ -2779,7 +2779,7 @@ var UnicodeArrayNodesGroup = function (_AbstractNodesGroup_) {
}
var unicodeArray = new UnicodeArray_1.UnicodeArray();
var unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(unicodeArray, this.unicodeArrayName, this.unicodeArrayRotateValue, this.options);
var customNodes = new Map([['unicodeArrayNode', unicodeArrayNode], ['unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray, this.options)]]);
var customNodes = new Map([['unicodeArrayNode', unicodeArrayNode], ['unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayCallsWrapper, this.unicodeArrayName, unicodeArray, this.options)]]);
if (this.options.rotateUnicodeArray) {
customNodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(this.unicodeArrayName, unicodeArray, this.unicodeArrayRotateValue, this.options));
}
@@ -4127,7 +4127,7 @@ exports.SingleNodeCallControllerTemplate = SingleNodeCallControllerTemplate;
"use strict";
function ConsoleOutputDisableExpressionTemplate() {
return "\n var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () { \n var _ = '(\x04\x06\x03\x05[]' + '[\"filter\"][\"\x07tructor\"]' + '(\"return this\")()' + '.' + '\x03;\x06\x02\x05\x04};' + '_\x03.log\x01.in' + 'fo\x01.' + 'war' + 'n\x01.er' + 'r' + 'or\x01})();' + '\x01\x05_\x02;' + '_\x03\x02function' + '\x03\x07ole\x04\x02 ()' + '{\x05 = \x06var ' + '_\x07cons', \n Y, \n $;\n \n for (Y in $ = \"\x07\x06\x05\x04\x03\x02\x01\") {\n var arr = _.split($[Y]);\n _ = arr.join(arr.pop());\n }\n \n [][\"filter\"][\"constructor\"](_)();\n });\n \n {consoleLogDisableFunctionName}();\n ";
return "\n var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n var getGlobal = Function('return typeof self !== \"undefined\"' + ' ? self : ' + 'typeof window !== \"undefined\"' + ' ? window : ' + 'typeof global !== \"undefined\"' + ' ? global : ' + '[][\"filter\"][\"constructor\"](\"return this\")()');\n \n var func = Function('for ' + '(;;)' + ' {}');\n var that = getGlobal();\n \n that.console.log = func; \n that.console.error = func;\n that.console.warn = func;\n that.console.info = func;\n });\n \n {consoleLogDisableFunctionName}();\n ";
}
exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
@@ -4176,7 +4176,7 @@ exports.DebugProtectionFunctionTemplate = DebugProtectionFunctionTemplate;
"use strict";
function DomainLockNodeTemplate() {
return "\n var {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n var getGlobal = function () {\n if (typeof self !== 'undefined') { return self; }\n if (typeof window !== 'undefined') { return window; }\n if (typeof global !== 'undefined') { return global; }\n };\n \n var func = function () { \n return {\n key: 'item',\n value: 'attribute',\n getAttribute: function () {\n getGlobal()['eval']('while(true){}')();\n }()\n };\n };\n \n var regExp = new RegExp(\"[{diff}]\", \"g\");\n var domains = \"{domains}\".replace(regExp, \"\").split(\";\");\n var eval = [][\"forEach\"][\"constructor\"];\n var windowObject = eval(\"return this\")();\n var document;\n var domain;\n \n for (var d in windowObject) {\n if (d.length == 8 && d.charCodeAt(7) == 116 && d.charCodeAt(5) == 101 && d.charCodeAt(3) == 117 && d.charCodeAt(0) == 100) {\n document = d;\n \n break;\n }\n }\n\n for (var d1 in windowObject[document]) {\n if (d1.length == 6 && d1.charCodeAt(5) == 110 && d1.charCodeAt(0) == 100) {\n domain = d1;\n \n break;\n }\n }\n \n if ((!document && !domain) || (!windowObject[document] && !windowObject[document][domain])) {\n return;\n }\n \n var currentDomain = windowObject[document][domain];\n\n var ok = false;\n \n for (var i = 0; i < domains.length; i++) {\n var domain = domains[i];\n var position = currentDomain.length - domain.length;\n var lastIndex = currentDomain.indexOf(domain, position);\n var endsWith = lastIndex !== -1 && lastIndex === position;\n \n if (endsWith) {\n if (currentDomain.length == domain.length || domain.indexOf(\".\") === 0) {\n ok = true;\n }\n \n break;\n }\n }\n \n if (!ok) {\n data;\n } else {\n return;\n }\n \n func();\n });\n\n {domainLockFunctionName}();\n ";
return "\n var {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n var getGlobal = Function('return typeof self !== \"undefined\"' + ' ? self : ' + 'typeof window !== \"undefined\"' + ' ? window : ' + 'typeof global !== \"undefined\"' + ' ? global : ' + '[][\"filter\"][\"constructor\"](\"return this\")()');\n \n var func = function () { \n return {\n key: 'item',\n value: 'attribute',\n getAttribute: function () {\n getGlobal()['eval']('while(true){}')();\n }()\n };\n };\n \n var regExp = new RegExp(\"[{diff}]\", \"g\");\n var domains = \"{domains}\".replace(regExp, \"\").split(\";\");\n var eval = [][\"forEach\"][\"constructor\"];\n var windowObject = eval(\"return this\")();\n var document;\n var domain;\n \n for (var d in windowObject) {\n if (d.length == 8 && d.charCodeAt(7) == 116 && d.charCodeAt(5) == 101 && d.charCodeAt(3) == 117 && d.charCodeAt(0) == 100) {\n document = d;\n \n break;\n }\n }\n\n for (var d1 in windowObject[document]) {\n if (d1.length == 6 && d1.charCodeAt(5) == 110 && d1.charCodeAt(0) == 100) {\n domain = d1;\n \n break;\n }\n }\n \n if ((!document && !domain) || (!windowObject[document] && !windowObject[document][domain])) {\n return;\n }\n \n var currentDomain = windowObject[document][domain];\n\n var ok = false;\n \n for (var i = 0; i < domains.length; i++) {\n var domain = domains[i];\n var position = currentDomain.length - domain.length;\n var lastIndex = currentDomain.indexOf(domain, position);\n var endsWith = lastIndex !== -1 && lastIndex === position;\n \n if (endsWith) {\n if (currentDomain.length == domain.length || domain.indexOf(\".\") === 0) {\n ok = true;\n }\n \n break;\n }\n }\n \n if (!ok) {\n data;\n } else {\n return;\n }\n \n func();\n });\n\n {domainLockFunctionName}();\n ";
}
exports.DomainLockNodeTemplate = DomainLockNodeTemplate;
+6 -6
View File
@@ -20,16 +20,16 @@ export class UnicodeArrayNodesGroup extends AbstractNodesGroup {
*/
private unicodeArrayName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
/**
* @type {string}
*/
private unicodeArrayCallsWrapper: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
/**
* @type {number}
*/
private unicodeArrayRotateValue: number;
/**
* @type {string}
*/
private unicodeArrayTranslatorName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
/**
* @returns {Map<string, ICustomNode> | undefined}
*/
@@ -61,7 +61,7 @@ export class UnicodeArrayNodesGroup extends AbstractNodesGroup {
[
'unicodeArrayCallsWrapper',
new UnicodeArrayCallsWrapper(
this.unicodeArrayTranslatorName,
this.unicodeArrayCallsWrapper,
this.unicodeArrayName,
unicodeArray,
this.options
@@ -3,17 +3,16 @@
*/
export function ConsoleOutputDisableExpressionTemplate (): string {
return `
var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, 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,
$;
var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
var getGlobal = Function('return typeof self !== "undefined"' + ' ? self : ' + 'typeof window !== "undefined"' + ' ? window : ' + 'typeof global !== "undefined"' + ' ? global : ' + '[]["filter"]["constructor"]("return this")()');
for (Y in $ = "\u0007\u0006\u0005\u0004\u0003\u0002\u0001") {
var arr = _.split($[Y]);
_ = arr.join(arr.pop());
}
[]["filter"]["constructor"](_)();
var func = Function('for ' + '(;;)' + ' {}');
var that = getGlobal();
that.console.log = func;
that.console.error = func;
that.console.warn = func;
that.console.info = func;
});
{consoleLogDisableFunctionName}();
@@ -4,11 +4,7 @@
export function DomainLockNodeTemplate (): string {
return `
var {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
var getGlobal = function () {
if (typeof self !== 'undefined') { return self; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
};
var getGlobal = Function('return typeof self !== "undefined"' + ' ? self : ' + 'typeof window !== "undefined"' + ' ? window : ' + 'typeof global !== "undefined"' + ' ? global : ' + '[]["filter"]["constructor"]("return this")()');
var func = function () {
return {
+1 -1
View File
@@ -69,7 +69,7 @@ if (!(<any>global)._babelPolyfill) {
})();
`,
{
disableConsoleOutput: false,
disableConsoleOutput: true,
unicodeArrayEncoding: 'rc4',
selfDefending: true
}