Ver Fonte

0.13.0-dev.0 release

sanex3339 há 7 anos atrás
pai
commit
53172ad8a1

+ 4 - 0
CHANGELOG.md

@@ -1,5 +1,9 @@
 Change Log
 ===
+v0.13.0
+---
+* Implemented custom `mangle` option algorithm without `esmangle`; fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/110
+
 v0.12.5
 ---
 * https://github.com/javascript-obfuscator/javascript-obfuscator/issues/139

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
dist/index.js


+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "javascript-obfuscator",
-  "version": "0.12.5",
+  "version": "0.13.0-dev.0",
   "description": "JavaScript obfuscator",
   "keywords": [
     "obfuscator",

+ 1 - 1
src/generators/identifier-name-generators/MangledIdentifierNameGenerator.ts

@@ -16,7 +16,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera
     /**
      * @type {string[]}
      */
-    private static nameSequence: string[] = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$'.split('');
+    private static nameSequence: string[] = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
 
     /**
      * Reserved JS words with length of 2-4 symbols that can be possible generated with this replacer

+ 0 - 0
src/templates/debug-protection-nodes/debug-protection-function-call-node/DebufProtectionFunctionCallTemplate.ts


+ 2 - 2
src/templates/debug-protection-nodes/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate.ts

@@ -6,8 +6,8 @@ export function DebugProtectionFunctionCallTemplate (): string {
         (function () {
             {singleNodeCallControllerFunctionName}(this, function () {
                 var regExp1 = new RegExp('function *\\\\( *\\\\)');
-                var regExp2 = new RegExp('\\\\+\\\\+ *\\(?:_0x(?:[a-f0-9]){4,6}|\\\\b[a-zA-Z]{1,2}\\\\b\\)');
-           
+                var regExp2 = new RegExp('\\\\+\\\\+ *\\(?:_0x(?:[a-f0-9]){4,6}|(?:\\\\b|\\\\d)[a-z0-9]{1,4}(?:\\\\b|\\\\d)\\)', 'i');
+       
                 var result = {debugProtectionFunctionName}('init');
                 
                 if (!regExp1.test(result + 'chain') || !regExp2.test(result + 'input')) {

+ 1 - 1
test/functional-tests/templates/custom-nodes/debug-protection-nodes/DebufProtectionFunctionCallTemplate.spec.ts

@@ -117,7 +117,7 @@ describe('DebugProtectionFunctionCallTemplate (): string', () => {
             );
 
             obfuscatedCode = obfuscationResult.getObfuscatedCode();
-            obfuscatedCode = obfuscatedCode.replace(/\+\+ *_0x([a-f0-9]){4,6}/, '++abc');
+            obfuscatedCode = obfuscatedCode.replace(/\+\+ *_0x([a-f0-9]){4,6}/, '');
 
             spawnThread(
                 () => obfuscatedCode,

+ 4 - 4
test/unit-tests/generators/identifier-name-generators/MangledlIdentifierNameGenerator.spec.ts

@@ -50,11 +50,11 @@ describe('MangledIdentifierNameGenerator', () => {
             })
         });
 
-        describe('variant #3: special character as mangled name', () => {
-            const expectedMangledIdentifierName: string = '_';
+        describe('variant #3: last mangled name with single character', () => {
+            const expectedMangledIdentifierName: string = 'Z';
 
             before(() => {
-                for (let i: number = 0; i <= 50; i++) {
+                for (let i: number = 0; i <= 49; i++) {
                     mangledIdentifierName = identifierNameGenerator.generate(6);
                 }
             });
@@ -68,7 +68,7 @@ describe('MangledIdentifierNameGenerator', () => {
             const expectedMangledIdentifierName: string = 'a0';
 
             before(() => {
-                for (let i: number = 0; i < 2; i++) {
+                for (let i: number = 0; i < 1; i++) {
                     mangledIdentifierName = identifierNameGenerator.generate(6);
                 }
             });

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff