sanex3339 9 years ago
parent
commit
2eb1417e14

+ 19 - 19
dist/src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.js

@@ -24,27 +24,27 @@ class UnicodeArrayDecodeNode extends Node_1.Node {
         return super.getNode();
         return super.getNode();
     }
     }
     getNodeStructure() {
     getNodeStructure() {
-        const atobPolyfill = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(`
-                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;
-                });
-            `, NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET), indexVariableName = Utils_1.Utils.getRandomVariableName(), tempArrayName = Utils_1.Utils.getRandomVariableName();
+        const indexVariableName = Utils_1.Utils.getRandomVariableName(), tempArrayName = Utils_1.Utils.getRandomVariableName();
         let node = esprima.parse(`
         let node = esprima.parse(`
             (function () {
             (function () {
-                ${atobPolyfill}
+                ${JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(`
+                    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;
+                    });
+                `, NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET)}
               
               
                 var ${tempArrayName} = [];
                 var ${tempArrayName} = [];
                 
                 

+ 19 - 20
src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts

@@ -67,30 +67,29 @@ export class UnicodeArrayDecodeNode extends Node {
      * @returns {INode}
      * @returns {INode}
      */
      */
     protected getNodeStructure (): INode {
     protected getNodeStructure (): INode {
-        const atobPolyfill: string = JavaScriptObfuscator.obfuscate(`
-                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),
-            indexVariableName: string = Utils.getRandomVariableName(),
+        const indexVariableName: string = Utils.getRandomVariableName(),
             tempArrayName: string = Utils.getRandomVariableName();
             tempArrayName: string = Utils.getRandomVariableName();
 
 
         let node: INode = esprima.parse(`
         let node: INode = esprima.parse(`
             (function () {
             (function () {
-                ${atobPolyfill}
+                ${JavaScriptObfuscator.obfuscate(`
+                    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)}
               
               
                 var ${tempArrayName} = [];
                 var ${tempArrayName} = [];