Browse Source

0.5.3 atob polyfill fix

sanex3339 9 years ago
parent
commit
e2c92db026

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

@@ -28,22 +28,24 @@ class UnicodeArrayDecodeNode extends Node_1.Node {
         let node = esprima.parse(`
         let node = esprima.parse(`
             (function () {
             (function () {
                 ${JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(`
                 ${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;
-                    });
+                    (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;
+                        });
+                    })();
                 `, NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET)}
                 `, NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET)}
               
               
                 var ${tempArrayName} = [];
                 var ${tempArrayName} = [];

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "javascript-obfuscator",
   "name": "javascript-obfuscator",
-  "version": "0.5.2",
+  "version": "0.5.3",
   "description": "JavaScript obfuscator",
   "description": "JavaScript obfuscator",
   "keywords": [
   "keywords": [
     "obfuscator",
     "obfuscator",

+ 18 - 16
src/custom-nodes/unicode-array-nodes/UnicodeArrayDecodeNode.ts

@@ -73,22 +73,24 @@ export class UnicodeArrayDecodeNode extends Node {
         let node: INode = esprima.parse(`
         let node: INode = esprima.parse(`
             (function () {
             (function () {
                 ${JavaScriptObfuscator.obfuscate(`
                 ${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;
-                    });
+                    (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)}
                 `, NO_CUSTOM_NODES_PRESET)}
               
               
                 var ${tempArrayName} = [];
                 var ${tempArrayName} = [];