|
@@ -441,6 +441,7 @@ exports.RandomGeneratorUtils = RandomGeneratorUtils;
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
+var tslib_1 = __webpack_require__(1);
|
|
|
function initializable() {
|
|
|
var initializeMethodKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'initialize';
|
|
|
|
|
@@ -452,21 +453,21 @@ function initializable() {
|
|
|
};
|
|
|
var initializeMethod = target[initializeMethodKey];
|
|
|
if (!initializeMethod || typeof initializeMethod !== 'function') {
|
|
|
- throw new Error('`' + initializeMethodKey + '` method with initialization logic not found. `@' + decoratorName + '` decorator requires `' + initializeMethodKey + '` method');
|
|
|
+ throw new Error("`" + initializeMethodKey + "` method with initialization logic not found. `@" + decoratorName + "` decorator requires `" + initializeMethodKey + "` method");
|
|
|
}
|
|
|
- var metadataPropertyKey = '_' + propertyKey;
|
|
|
+ var metadataPropertyKey = "_" + propertyKey;
|
|
|
var propertyDescriptor = Object.getOwnPropertyDescriptor(target, metadataPropertyKey) || descriptor;
|
|
|
var methodDescriptor = Object.getOwnPropertyDescriptor(target, initializeMethodKey) || descriptor;
|
|
|
var originalMethod = methodDescriptor.value;
|
|
|
- Object.defineProperty(target, propertyKey, Object.assign({}, propertyDescriptor, { get: function get() {
|
|
|
+ Object.defineProperty(target, propertyKey, tslib_1.__assign({}, propertyDescriptor, { get: function get() {
|
|
|
if (this[metadataPropertyKey] === undefined) {
|
|
|
- throw new Error('Property `' + propertyKey + '` is not initialized! Initialize it first!');
|
|
|
+ throw new Error("Property `" + propertyKey + "` is not initialized! Initialize it first!");
|
|
|
}
|
|
|
return this[metadataPropertyKey];
|
|
|
}, set: function set(newVal) {
|
|
|
this[metadataPropertyKey] = newVal;
|
|
|
} }));
|
|
|
- Object.defineProperty(target, initializeMethodKey, Object.assign({}, methodDescriptor, { value: function value() {
|
|
|
+ Object.defineProperty(target, initializeMethodKey, tslib_1.__assign({}, methodDescriptor, { value: function value() {
|
|
|
originalMethod.apply(this, arguments);
|
|
|
if (this[propertyKey]) {}
|
|
|
} }));
|
|
@@ -2141,7 +2142,7 @@ var JavaScriptObfuscatorInternal = JavaScriptObfuscatorInternal_1 = function ()
|
|
|
}, {
|
|
|
key: "generateCode",
|
|
|
value: function generateCode(sourceCode, astTree) {
|
|
|
- var escodegenParams = Object.assign({}, JavaScriptObfuscatorInternal_1.escodegenParams);
|
|
|
+ var escodegenParams = tslib_1.__assign({}, JavaScriptObfuscatorInternal_1.escodegenParams);
|
|
|
if (this.options.sourceMap) {
|
|
|
escodegenParams.sourceMap = 'sourceMap';
|
|
|
escodegenParams.sourceContent = sourceCode;
|
|
@@ -4045,7 +4046,7 @@ var NodeCallsControllerFunctionNode = function (_AbstractCustomNode_) {
|
|
|
if (this.appendEvent === ObfuscationEvents_1.ObfuscationEvents.AfterObfuscation) {
|
|
|
return JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
|
|
|
singleNodeCallControllerFunctionName: this.callsControllerFunctionName
|
|
|
- }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
|
|
|
+ }), tslib_1.__assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
|
|
|
}
|
|
|
return format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
|
|
|
singleNodeCallControllerFunctionName: this.callsControllerFunctionName
|
|
@@ -4259,7 +4260,7 @@ var StringArrayCallsWrapper = function (_AbstractCustomNode_) {
|
|
|
decodeNodeTemplate: decodeNodeTemplate,
|
|
|
stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
|
|
|
stringArrayName: this.stringArrayName
|
|
|
- }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
|
|
|
+ }), tslib_1.__assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
|
|
|
}
|
|
|
}, {
|
|
|
key: "getDecodeStringArrayTemplate",
|
|
@@ -4440,7 +4441,7 @@ var StringArrayRotateFunctionNode = function (_AbstractCustomNode_) {
|
|
|
stringArrayName: this.stringArrayName,
|
|
|
stringArrayRotateValue: Utils_1.Utils.decToHex(this.stringArrayRotateValue),
|
|
|
whileFunctionName: whileFunctionName
|
|
|
- }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
|
|
|
+ }), tslib_1.__assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
|
|
|
}
|
|
|
}]);
|
|
|
|
|
@@ -5199,6 +5200,8 @@ var MethodDefinitionTransformer_1;
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
|
+
|
|
|
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
|
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -5255,11 +5258,17 @@ var TemplateLiteralTransformer = TemplateLiteralTransformer_1 = function (_Abstr
|
|
|
nodes.unshift(Nodes_1.Nodes.getLiteralNode(''));
|
|
|
}
|
|
|
if (nodes.length > 1) {
|
|
|
- var root = Nodes_1.Nodes.getBinaryExpressionNode('+', nodes.shift(), nodes.shift());
|
|
|
- nodes.forEach(function (node) {
|
|
|
- root = Nodes_1.Nodes.getBinaryExpressionNode('+', root, node);
|
|
|
- });
|
|
|
- return root;
|
|
|
+ var _ret = function () {
|
|
|
+ var root = Nodes_1.Nodes.getBinaryExpressionNode('+', nodes.shift(), nodes.shift());
|
|
|
+ nodes.forEach(function (node) {
|
|
|
+ root = Nodes_1.Nodes.getBinaryExpressionNode('+', root, node);
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ v: root
|
|
|
+ };
|
|
|
+ }();
|
|
|
+
|
|
|
+ if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
|
|
|
}
|
|
|
return nodes[0];
|
|
|
}
|
|
@@ -5395,33 +5404,19 @@ var DeadCodeInjectionTransformer = DeadCodeInjectionTransformer_1 = function (_A
|
|
|
}, {
|
|
|
key: "replaceBlockStatementNodes",
|
|
|
value: function replaceBlockStatementNodes(blockStatementNode, randomBlockStatementNode) {
|
|
|
+ var random1 = RandomGeneratorUtils_1.RandomGeneratorUtils.getMathRandom() > 0.5;
|
|
|
+ var random2 = RandomGeneratorUtils_1.RandomGeneratorUtils.getMathRandom() > 0.5;
|
|
|
+ var operator = random1 ? '===' : '!==';
|
|
|
var leftString = RandomGeneratorUtils_1.RandomGeneratorUtils.getRandomString(3);
|
|
|
- var operator = void 0,
|
|
|
- rightString = void 0,
|
|
|
- consequent = void 0,
|
|
|
+ var rightString = random2 ? leftString : RandomGeneratorUtils_1.RandomGeneratorUtils.getRandomString(3);
|
|
|
+ var consequent = void 0,
|
|
|
alternate = void 0;
|
|
|
- if (RandomGeneratorUtils_1.RandomGeneratorUtils.getMathRandom() > 0.5) {
|
|
|
- operator = '===';
|
|
|
- if (RandomGeneratorUtils_1.RandomGeneratorUtils.getMathRandom() > 0.5) {
|
|
|
- rightString = leftString;
|
|
|
- consequent = blockStatementNode;
|
|
|
- alternate = randomBlockStatementNode;
|
|
|
- } else {
|
|
|
- rightString = RandomGeneratorUtils_1.RandomGeneratorUtils.getRandomString(3);
|
|
|
- consequent = randomBlockStatementNode;
|
|
|
- alternate = blockStatementNode;
|
|
|
- }
|
|
|
+ if (random1 && random2 || !random1 && !random2) {
|
|
|
+ consequent = blockStatementNode;
|
|
|
+ alternate = randomBlockStatementNode;
|
|
|
} else {
|
|
|
- operator = '!==';
|
|
|
- if (RandomGeneratorUtils_1.RandomGeneratorUtils.getMathRandom() > 0.5) {
|
|
|
- rightString = leftString;
|
|
|
- consequent = randomBlockStatementNode;
|
|
|
- alternate = blockStatementNode;
|
|
|
- } else {
|
|
|
- rightString = RandomGeneratorUtils_1.RandomGeneratorUtils.getRandomString(3);
|
|
|
- consequent = blockStatementNode;
|
|
|
- alternate = randomBlockStatementNode;
|
|
|
- }
|
|
|
+ consequent = randomBlockStatementNode;
|
|
|
+ alternate = blockStatementNode;
|
|
|
}
|
|
|
var newBlockStatementNode = Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getIfStatementNode(Nodes_1.Nodes.getBinaryExpressionNode(operator, Nodes_1.Nodes.getLiteralNode(leftString), Nodes_1.Nodes.getLiteralNode(rightString)), consequent, alternate)]);
|
|
|
newBlockStatementNode = NodeUtils_1.NodeUtils.parentize(newBlockStatementNode);
|
|
@@ -6752,7 +6747,7 @@ var StackTraceAnalyzer = StackTraceAnalyzer_1 = function () {
|
|
|
if (!calleeData) {
|
|
|
return;
|
|
|
}
|
|
|
- stackTraceData.push(Object.assign({}, calleeData, { stackTrace: _this2.analyzeRecursive(calleeData.callee.body) }));
|
|
|
+ stackTraceData.push(tslib_1.__assign({}, calleeData, { stackTrace: _this2.analyzeRecursive(calleeData.callee.body) }));
|
|
|
});
|
|
|
}
|
|
|
}], [{
|