This commit is contained in:
sanex3339
2016-06-01 16:45:19 +03:00
parent 515ffa0a22
commit 19b1a13971
6 changed files with 15 additions and 16 deletions
+3 -2
View File
@@ -13,8 +13,9 @@ class JavaScriptObfuscator {
static generateCode(astTree, options) {
let escodegenParams = Object.assign({}, JavaScriptObfuscator.escodegenParams);
if (options.hasOwnProperty('compact')) {
escodegenParams.format = {};
escodegenParams.format.compact = options.compact;
escodegenParams.format = {
compact: options.compact
};
}
return escodegen.generate(astTree, escodegenParams);
}
+3 -1
View File
@@ -88,7 +88,9 @@ class Obfuscator {
if (this.options['debugProtection']) {
this.setNodesGroup(new DebugProtectionNodesGroup_1.DebugProtectionNodesGroup(this.options));
}
this.setNodesGroup(new UnicodeArrayNodesGroup_1.UnicodeArrayNodesGroup(this.options));
if (this.options['unicodeArray']) {
this.setNodesGroup(new UnicodeArrayNodesGroup_1.UnicodeArrayNodesGroup(this.options));
}
}
}
exports.Obfuscator = Obfuscator;
-3
View File
@@ -12,9 +12,6 @@ class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
this.unicodeArrayRotateValue = this.options['rotateUnicodeArray'] ? Utils_1.Utils.getRandomInteger(100, 500) : 0;
let unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(this.unicodeArrayName, this.unicodeArrayRotateValue), unicodeArray = unicodeArrayNode.getNodeData();
if (!this.options['unicodeArray']) {
return;
}
this.nodes.set('unicodeArrayNode', unicodeArrayNode);
if (this.options['wrapUnicodeArrayCalls']) {
this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray));
+3 -2
View File
@@ -41,8 +41,9 @@ export class JavaScriptObfuscator {
let escodegenParams: escodegen.GenerateOptions = Object.assign({}, JavaScriptObfuscator.escodegenParams);
if (options.hasOwnProperty('compact')) {
escodegenParams.format = {};
escodegenParams.format.compact = options.compact;
escodegenParams.format = {
compact: options.compact
};
}
return escodegen.generate(astTree, escodegenParams);
+6 -4
View File
@@ -155,9 +155,11 @@ export class Obfuscator {
this.setNodesGroup(new DebugProtectionNodesGroup(this.options));
}
/**
* Important to set this nodes latest to prevent runtime errors cause by `rotateUnicodeArray` option
*/
this.setNodesGroup(new UnicodeArrayNodesGroup(this.options));
if (this.options['unicodeArray']) {
/**
* Important to set this nodes latest to prevent runtime errors cause by `rotateUnicodeArray` option
*/
this.setNodesGroup(new UnicodeArrayNodesGroup(this.options));
}
}
}
@@ -37,10 +37,6 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
),
unicodeArray: string [] = unicodeArrayNode.getNodeData();
if (!this.options['unicodeArray']) {
return;
}
this.nodes.set(
'unicodeArrayNode',
unicodeArrayNode