diff --git a/dist/index.js b/dist/index.js index 1ea3bb3a..aeb732da 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1564,12 +1564,12 @@ var Obfuscator = function () { NodeUtils_1.NodeUtils.parentize(node); var stackTraceData = new StackTraceAnalyzer_1.StackTraceAnalyzer(node.body).analyze(); this.initializeCustomNodes(stackTraceData); - this.beforeObfuscation(node); - this.obfuscate(node); - this.afterObfuscation(node); if (this.options.controlFlow) { this.changeControlFlow(node); } + this.beforeObfuscation(node); + this.obfuscate(node); + this.afterObfuscation(node); return node; } }, { @@ -3151,7 +3151,7 @@ var AbstractControlFlowReplacer = function () { key: 'getStorageKey', value: function getStorageKey() { return Utils_1.Utils.getRandomGenerator().string({ - length: 4, + length: 3, pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' }); } diff --git a/src/Obfuscator.ts b/src/Obfuscator.ts index 3f2b73cd..8e5072b5 100644 --- a/src/Obfuscator.ts +++ b/src/Obfuscator.ts @@ -104,14 +104,14 @@ export class Obfuscator implements IObfuscator { this.initializeCustomNodes(stackTraceData); - this.beforeObfuscation(node); - this.obfuscate(node); - this.afterObfuscation(node); - if (this.options.controlFlow) { this.changeControlFlow(node); } + this.beforeObfuscation(node); + this.obfuscate(node); + this.afterObfuscation(node); + return node; } diff --git a/src/node-control-flow-changers/control-flow-replacers/AbstractControlFlowReplacer.ts b/src/node-control-flow-changers/control-flow-replacers/AbstractControlFlowReplacer.ts index a6b952f2..e7752a2e 100644 --- a/src/node-control-flow-changers/control-flow-replacers/AbstractControlFlowReplacer.ts +++ b/src/node-control-flow-changers/control-flow-replacers/AbstractControlFlowReplacer.ts @@ -32,7 +32,7 @@ export abstract class AbstractControlFlowReplacer implements IControlFlowReplace */ protected static getStorageKey (): string { return Utils.getRandomGenerator().string({ - length: 4, + length: 3, pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' }); } diff --git a/test/dev/dev.ts b/test/dev/dev.ts index 7fdb7af3..5a409184 100644 --- a/test/dev/dev.ts +++ b/test/dev/dev.ts @@ -1,5 +1,4 @@ 'use strict'; -import { NO_CUSTOM_NODES_PRESET } from '../../src/preset-options/NoCustomNodesPreset'; if (!(global)._babelPolyfill) { require('babel-polyfill'); @@ -50,9 +49,12 @@ if (!(global)._babelPolyfill) { console.log(n); })(); `, - Object.assign({}, NO_CUSTOM_NODES_PRESET, { - controlFlow: true - }) + { + controlFlow: true, + disableConsoleOutput: false, + selfDefending: true, + stringArrayEncoding: 'rc4' + } ).getObfuscatedCode(); console.log(obfuscatedCode);