sanex3339 преди 8 години
родител
ревизия
5d0434fa97
променени са 4 файла, в които са добавени 255 реда и са изтрити 180 реда
  1. 5 0
      README.md
  2. 247 172
      dist/index.js
  3. 1 6
      src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts
  4. 2 2
      test/dev/dev.ts

+ 5 - 0
README.md

@@ -465,6 +465,8 @@ Performance will 50-100% slower than without obfuscation
     compact: true,
     controlFlowFlattening: true,
     controlFlowFlatteningThreshold: 1,
+    deadCodeInjection: true,
+	deadCodeInjectionThreshold: 1,
     debugProtection: true,
     debugProtectionInterval: true,
     disableConsoleOutput: true,
@@ -486,6 +488,8 @@ Performance will 30-35% slower than without obfuscation
     compact: true,
     controlFlowFlattening: true,
     controlFlowFlatteningThreshold: 0.75,
+    deadCodeInjection: true,
+    deadCodeInjectionThreshold: 0.75,
     debugProtection: false,
     debugProtectionInterval: false,
     disableConsoleOutput: true,
@@ -506,6 +510,7 @@ Performance will slightly slower than without obfuscation
 {
     compact: true,
     controlFlowFlattening: false,
+    deadCodeInjection: false,
     debugProtection: false,
     debugProtectionInterval: false,
     disableConsoleOutput: true,

Файловите разлики са ограничени, защото са твърде много
+ 247 - 172
dist/index.js


+ 1 - 6
src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts

@@ -6,7 +6,6 @@ import * as ESTree from 'estree';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IVisitor } from '../../interfaces/IVisitor';
 
-
 import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { Node } from '../../node/Node';
 import { RandomGeneratorUtils } from '../../utils/RandomGeneratorUtils';
@@ -48,10 +47,6 @@ export class DeadCodeInjectionTransformer extends AbstractNodeTransformer {
             return blockStatementNode;
         }
 
-        const blockStatementBody: ESTree.Statement[] = blockStatementNode.body;
-
-
-
-        return blockStatementBody[0];
+        return blockStatementNode;
     }
 }

+ 2 - 2
test/dev/dev.ts

@@ -30,8 +30,8 @@ import { NO_CUSTOM_NODES_PRESET } from '../../src/options/presets/NoCustomNodes'
             compact: false,
             stringArray: true,
             stringArrayThreshold: 1,
-            controlFlowFlattening: true,
-            controlFlowFlatteningThreshold: 1
+            deadCodeInjection: true,
+            deadCodeInjectionThreshold: 1
         }
     ).getObfuscatedCode();
 

Някои файлове не бяха показани, защото твърде много файлове са промени