First draw of control flow change. Right now for binary expressions.

This commit is contained in:
sanex3339
2016-11-21 01:48:27 +03:00
parent ee018dd75b
commit 8e5c127226
4 changed files with 15 additions and 13 deletions
+4 -4
View File
@@ -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'
});
}
+4 -4
View File
@@ -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;
}
@@ -32,7 +32,7 @@ export abstract class AbstractControlFlowReplacer implements IControlFlowReplace
*/
protected static getStorageKey (): string {
return Utils.getRandomGenerator().string({
length: 4,
length: 3,
pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
});
}
+6 -4
View File
@@ -1,5 +1,4 @@
'use strict';
import { NO_CUSTOM_NODES_PRESET } from '../../src/preset-options/NoCustomNodesPreset';
if (!(<any>global)._babelPolyfill) {
require('babel-polyfill');
@@ -50,9 +49,12 @@ if (!(<any>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);