فهرست منبع

ConsoleOutputDisableExpressionTemplate rewrite

sanex3339 8 سال پیش
والد
کامیت
dd410f4703

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 3
dist/index.js


+ 5 - 5
src/node-groups/UnicodeArrayNodesGroup.ts

@@ -21,14 +21,14 @@ export class UnicodeArrayNodesGroup extends AbstractNodesGroup {
     private unicodeArrayName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
 
     /**
-     * @type {number}
+     * @type {string}
      */
-    private unicodeArrayRotateValue: number;
+    private unicodeArrayCallsWrapper: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
 
     /**
-     * @type {string}
+     * @type {number}
      */
-    private unicodeArrayTranslatorName: string = Utils.getRandomVariableName(UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
+    private unicodeArrayRotateValue: number;
 
     /**
      * @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

+ 9 - 10
src/templates/custom-nodes/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts

@@ -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}();

+ 1 - 5
src/templates/custom-nodes/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate.ts

@@ -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
test/dev/dev.ts

@@ -69,7 +69,7 @@ if (!(<any>global)._babelPolyfill) {
     })();
     `,
         {
-            disableConsoleOutput: false,
+            disableConsoleOutput: true,
             unicodeArrayEncoding: 'rc4',
             selfDefending: true
         }

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است