mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
refactoring
This commit is contained in:
Vendored
+164
-245
@@ -213,8 +213,10 @@ var _createClass = function () { function defineProperties(target, props) { for
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var escodegen = __webpack_require__(11);
|
||||
var esprima = __webpack_require__(7);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var NodeType_1 = __webpack_require__(3);
|
||||
var Nodes_1 = __webpack_require__(8);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
@@ -224,18 +226,21 @@ var NodeUtils = function () {
|
||||
}
|
||||
|
||||
_createClass(NodeUtils, null, [{
|
||||
key: "addXVerbatimPropertyToLiterals",
|
||||
key: 'addXVerbatimPropertyToLiterals',
|
||||
value: function addXVerbatimPropertyToLiterals(node) {
|
||||
estraverse.replace(node, {
|
||||
enter: function enter(node, parentNode) {
|
||||
if (Nodes_1.Nodes.isLiteralNode(node)) {
|
||||
node['x-verbatim-property'] = node.raw;
|
||||
node['x-verbatim-property'] = {
|
||||
content: node.raw,
|
||||
precedence: escodegen.Precedence.Primary
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "appendNode",
|
||||
key: 'appendNode',
|
||||
value: function appendNode(blockScopeBody, node) {
|
||||
if (!NodeUtils.validateNode(node)) {
|
||||
return;
|
||||
@@ -243,20 +248,27 @@ var NodeUtils = function () {
|
||||
blockScopeBody.push(node);
|
||||
}
|
||||
}, {
|
||||
key: "getBlockStatementNodeByIndex",
|
||||
key: 'convertCodeToStructure',
|
||||
value: function convertCodeToStructure(code) {
|
||||
var structure = esprima.parse(code);
|
||||
NodeUtils.addXVerbatimPropertyToLiterals(structure);
|
||||
return NodeUtils.getBlockStatementNodeByIndex(structure);
|
||||
}
|
||||
}, {
|
||||
key: 'getBlockStatementNodeByIndex',
|
||||
value: function getBlockStatementNodeByIndex(node) {
|
||||
var index = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
|
||||
|
||||
if (Nodes_1.Nodes.isNodeHasBlockStatement(node)) {
|
||||
if (node.body[index] === undefined) {
|
||||
throw new ReferenceError("Wrong index `" + index + "`. Block-statement body length is `" + node.body.length + "`");
|
||||
throw new ReferenceError('Wrong index `' + index + '`. Block-statement body length is `' + node.body.length + '`');
|
||||
}
|
||||
return node.body[index];
|
||||
}
|
||||
throw new TypeError('The specified node have no a block-statement');
|
||||
}
|
||||
}, {
|
||||
key: "getBlockScopeOfNode",
|
||||
key: 'getBlockScopeOfNode',
|
||||
value: function getBlockScopeOfNode(node) {
|
||||
var depth = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];
|
||||
|
||||
@@ -278,7 +290,7 @@ var NodeUtils = function () {
|
||||
return NodeUtils.getBlockScopeOfNode(parentNode);
|
||||
}
|
||||
}, {
|
||||
key: "insertNodeAtIndex",
|
||||
key: 'insertNodeAtIndex',
|
||||
value: function insertNodeAtIndex(blockScopeBody, node, index) {
|
||||
if (!NodeUtils.validateNode(node)) {
|
||||
return;
|
||||
@@ -286,7 +298,7 @@ var NodeUtils = function () {
|
||||
blockScopeBody.splice(index, 0, node);
|
||||
}
|
||||
}, {
|
||||
key: "parentize",
|
||||
key: 'parentize',
|
||||
value: function parentize(node) {
|
||||
var isRootNode = true;
|
||||
estraverse.replace(node, {
|
||||
@@ -302,7 +314,7 @@ var NodeUtils = function () {
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "prependNode",
|
||||
key: 'prependNode',
|
||||
value: function prependNode(blockScopeBody, node) {
|
||||
if (!NodeUtils.validateNode(node)) {
|
||||
return;
|
||||
@@ -310,7 +322,7 @@ var NodeUtils = function () {
|
||||
blockScopeBody.unshift(node);
|
||||
}
|
||||
}, {
|
||||
key: "validateNode",
|
||||
key: 'validateNode',
|
||||
value: function validateNode(node) {
|
||||
return !!node && node.hasOwnProperty('type');
|
||||
}
|
||||
@@ -324,6 +336,19 @@ exports.NodeUtils = NodeUtils;
|
||||
|
||||
/***/ },
|
||||
/* 2 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
(function (AppendState) {
|
||||
AppendState[AppendState["AfterObfuscation"] = 0] = "AfterObfuscation";
|
||||
AppendState[AppendState["BeforeObfuscation"] = 1] = "BeforeObfuscation";
|
||||
})(exports.AppendState || (exports.AppendState = {}));
|
||||
var AppendState = exports.AppendState;
|
||||
|
||||
/***/ },
|
||||
/* 3 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
@@ -361,61 +386,11 @@ exports.NodeType = Utils_1.Utils.strEnumify({
|
||||
});
|
||||
|
||||
/***/ },
|
||||
/* 3 */
|
||||
/* 4 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
module.exports = require("estraverse");
|
||||
|
||||
/***/ },
|
||||
/* 4 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
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"); } }
|
||||
|
||||
var AppendState_1 = __webpack_require__(6);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
|
||||
var Node = function () {
|
||||
function Node(options) {
|
||||
_classCallCheck(this, Node);
|
||||
|
||||
this.appendState = AppendState_1.AppendState.BeforeObfuscation;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
_createClass(Node, [{
|
||||
key: "getAppendState",
|
||||
value: function getAppendState() {
|
||||
return this.appendState;
|
||||
}
|
||||
}, {
|
||||
key: "getNode",
|
||||
value: function getNode() {
|
||||
NodeUtils_1.NodeUtils.parentize(this.node);
|
||||
return this.node;
|
||||
}
|
||||
}, {
|
||||
key: "setNode",
|
||||
value: function setNode(node) {
|
||||
this.node = node;
|
||||
}
|
||||
}, {
|
||||
key: "updateNode",
|
||||
value: function updateNode() {
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
}]);
|
||||
|
||||
return Node;
|
||||
}();
|
||||
|
||||
exports.Node = Node;
|
||||
|
||||
/***/ },
|
||||
/* 5 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
@@ -427,7 +402,46 @@ var _createClass = function () { function defineProperties(target, props) { for
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
|
||||
var Node = function () {
|
||||
function Node(options) {
|
||||
_classCallCheck(this, Node);
|
||||
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
_createClass(Node, [{
|
||||
key: "getAppendState",
|
||||
value: function getAppendState() {
|
||||
return this.appendState;
|
||||
}
|
||||
}, {
|
||||
key: "getNode",
|
||||
value: function getNode() {
|
||||
var node = this.getNodeStructure();
|
||||
NodeUtils_1.NodeUtils.parentize(node);
|
||||
return node;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Node;
|
||||
}();
|
||||
|
||||
exports.Node = Node;
|
||||
|
||||
/***/ },
|
||||
/* 6 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
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"); } }
|
||||
|
||||
var estraverse = __webpack_require__(4);
|
||||
var JSFuck_1 = __webpack_require__(10);
|
||||
var Nodes_1 = __webpack_require__(8);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
@@ -523,19 +537,6 @@ var NodeObfuscator = function () {
|
||||
|
||||
exports.NodeObfuscator = NodeObfuscator;
|
||||
|
||||
/***/ },
|
||||
/* 6 */
|
||||
/***/ function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
(function (AppendState) {
|
||||
AppendState[AppendState["AfterObfuscation"] = 0] = "AfterObfuscation";
|
||||
AppendState[AppendState["BeforeObfuscation"] = 1] = "BeforeObfuscation";
|
||||
})(exports.AppendState || (exports.AppendState = {}));
|
||||
var AppendState = exports.AppendState;
|
||||
|
||||
/***/ },
|
||||
/* 7 */
|
||||
/***/ function(module, exports) {
|
||||
@@ -553,7 +554,7 @@ var _createClass = function () { function defineProperties(target, props) { for
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var NodeType_1 = __webpack_require__(3);
|
||||
|
||||
var Nodes = function () {
|
||||
function Nodes() {
|
||||
@@ -846,9 +847,9 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var estraverse = __webpack_require__(3);
|
||||
var AppendState_1 = __webpack_require__(6);
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var NodeType_1 = __webpack_require__(3);
|
||||
var CatchClauseObfuscator_1 = __webpack_require__(34);
|
||||
var ConsoleOutputNodesGroup_1 = __webpack_require__(30);
|
||||
var DebugProtectionNodesGroup_1 = __webpack_require__(31);
|
||||
@@ -1205,31 +1206,37 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var esprima = __webpack_require__(7);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
|
||||
var ConsoleOutputDisableExpressionNode = function (_Node_1$Node) {
|
||||
_inherits(ConsoleOutputDisableExpressionNode, _Node_1$Node);
|
||||
|
||||
function ConsoleOutputDisableExpressionNode(options) {
|
||||
function ConsoleOutputDisableExpressionNode() {
|
||||
var _Object$getPrototypeO;
|
||||
|
||||
_classCallCheck(this, ConsoleOutputDisableExpressionNode);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ConsoleOutputDisableExpressionNode).call(this, options));
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
_this.node = _this.getNodeStructure();
|
||||
var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).call.apply(_Object$getPrototypeO, [this].concat(args)));
|
||||
|
||||
_this.appendState = AppendState_1.AppendState.BeforeObfuscation;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(ConsoleOutputDisableExpressionNode, [{
|
||||
key: 'appendNode',
|
||||
key: "appendNode",
|
||||
value: function appendNode(blockScopeNode) {
|
||||
NodeUtils_1.NodeUtils.prependNode(blockScopeNode.body, this.getNode());
|
||||
}
|
||||
}, {
|
||||
key: 'getNodeStructure',
|
||||
key: "getNodeStructure",
|
||||
value: function getNodeStructure() {
|
||||
return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(esprima.parse('\n (function () {\n var _ = \'(\u0004\u0006\u0003\u0005[]\' + \'["filter"]["\u0007tructor"]\' + \'("return this")()\' + \'.\' + \'\u0003;\u0006\u0002\u0005\u0004};\' + \'_\u0003.log\u0001.in\' + \'fo\u0001.\' + \'war\' + \'n\u0001.er\' + \'r\' + \'or\u0001})();\' + \'\u0001\u0005_\u0002;\' + \'_\u0003\u0002function\' + \'\u0003\u0007ole\u0004\u0002 ()\' + \'{\u0005 = \u0006var \' + \'_\u0007cons\', \n Y, \n $;\n \n for (Y in $ = "\u0007\u0006\u0005\u0004\u0003\u0002\u0001") {\n var arr = _.split($[Y]);\n _ = arr.join(arr.pop());\n }\n \n []["filter"]["constructor"](_)();\n })()\n '));
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure("\n (function () {\n var _ = '(\u0004\u0006\u0003\u0005[]' + '[\"filter\"][\"\u0007tructor\"]' + '(\"return this\")()' + '.' + '\u0003;\u0006\u0002\u0005\u0004};' + '_\u0003.log\u0001.in' + 'fo\u0001.' + 'war' + 'n\u0001.er' + 'r' + 'or\u0001})();' + '\u0001\u0005_\u0002;' + '_\u0003\u0002function' + '\u0003\u0007ole\u0004\u0002 ()' + '{\u0005 = \u0006var ' + '_\u0007cons', \n Y, \n $;\n \n for (Y in $ = \"\u0007\u0006\u0005\u0004\u0003\u0002\u0001\") {\n var arr = _.split($[Y]);\n _ = arr.join(arr.pop());\n }\n \n [][\"filter\"][\"constructor\"](_)();\n })()\n ");
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1253,8 +1260,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
|
||||
var DebugProtectionFunctionCallNode = function (_Node_1$Node) {
|
||||
@@ -1265,8 +1272,8 @@ var DebugProtectionFunctionCallNode = function (_Node_1$Node) {
|
||||
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionCallNode).call(this, options));
|
||||
|
||||
_this.appendState = AppendState_1.AppendState.BeforeObfuscation;
|
||||
_this.debugProtectionFunctionName = debugProtectionFunctionName;
|
||||
_this.node = _this.getNodeStructure();
|
||||
return _this;
|
||||
}
|
||||
|
||||
@@ -1278,17 +1285,7 @@ var DebugProtectionFunctionCallNode = function (_Node_1$Node) {
|
||||
}, {
|
||||
key: "getNodeStructure",
|
||||
value: function getNodeStructure() {
|
||||
return {
|
||||
'type': NodeType_1.NodeType.ExpressionStatement,
|
||||
'expression': {
|
||||
'type': NodeType_1.NodeType.CallExpression,
|
||||
'callee': {
|
||||
'type': NodeType_1.NodeType.Identifier,
|
||||
'name': this.debugProtectionFunctionName
|
||||
},
|
||||
'arguments': []
|
||||
}
|
||||
};
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure("\n " + this.debugProtectionFunctionName + "();\n ");
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1312,8 +1309,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
|
||||
var DebugProtectionFunctionIntervalNode = function (_Node_1$Node) {
|
||||
@@ -1324,55 +1321,20 @@ var DebugProtectionFunctionIntervalNode = function (_Node_1$Node) {
|
||||
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionIntervalNode).call(this, options));
|
||||
|
||||
_this.appendState = AppendState_1.AppendState.BeforeObfuscation;
|
||||
_this.debugProtectionFunctionName = debugProtectionFunctionName;
|
||||
_this.node = _this.getNodeStructure();
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(DebugProtectionFunctionIntervalNode, [{
|
||||
key: 'appendNode',
|
||||
key: "appendNode",
|
||||
value: function appendNode(blockScopeNode) {
|
||||
NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
|
||||
}
|
||||
}, {
|
||||
key: 'getNodeStructure',
|
||||
key: "getNodeStructure",
|
||||
value: function getNodeStructure() {
|
||||
return {
|
||||
'type': NodeType_1.NodeType.ExpressionStatement,
|
||||
'expression': {
|
||||
'type': NodeType_1.NodeType.CallExpression,
|
||||
'callee': {
|
||||
'type': NodeType_1.NodeType.Identifier,
|
||||
'name': 'setInterval'
|
||||
},
|
||||
'arguments': [{
|
||||
'type': NodeType_1.NodeType.FunctionExpression,
|
||||
'id': null,
|
||||
'params': [],
|
||||
'defaults': [],
|
||||
'body': {
|
||||
'type': NodeType_1.NodeType.BlockStatement,
|
||||
'body': [{
|
||||
'type': NodeType_1.NodeType.ExpressionStatement,
|
||||
'expression': {
|
||||
'type': NodeType_1.NodeType.CallExpression,
|
||||
'callee': {
|
||||
'type': NodeType_1.NodeType.Identifier,
|
||||
'name': this.debugProtectionFunctionName
|
||||
},
|
||||
'arguments': []
|
||||
}
|
||||
}]
|
||||
},
|
||||
'generator': false,
|
||||
'expression': false
|
||||
}, {
|
||||
'type': NodeType_1.NodeType.Literal,
|
||||
'value': 4000,
|
||||
'raw': '4000'
|
||||
}]
|
||||
}
|
||||
};
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure("\n setInterval(function () {\n " + this.debugProtectionFunctionName + "();\n }, 4000);\n ");
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1396,8 +1358,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var esprima = __webpack_require__(7);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
@@ -1409,13 +1371,13 @@ var DebugProtectionFunctionNode = function (_Node_1$Node) {
|
||||
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(DebugProtectionFunctionNode).call(this, options));
|
||||
|
||||
_this.appendState = AppendState_1.AppendState.BeforeObfuscation;
|
||||
_this.debugProtectionFunctionName = debugProtectionFunctionName;
|
||||
_this.node = _this.getNodeStructure();
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(DebugProtectionFunctionNode, [{
|
||||
key: 'appendNode',
|
||||
key: "appendNode",
|
||||
value: function appendNode(blockScopeNode) {
|
||||
var programBodyLength = blockScopeNode.body.length,
|
||||
randomIndex = Utils_1.Utils.getRandomGenerator().integer({
|
||||
@@ -1425,14 +1387,14 @@ var DebugProtectionFunctionNode = function (_Node_1$Node) {
|
||||
NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex);
|
||||
}
|
||||
}, {
|
||||
key: 'getNodeIdentifier',
|
||||
key: "getNodeIdentifier",
|
||||
value: function getNodeIdentifier() {
|
||||
return this.debugProtectionFunctionName;
|
||||
}
|
||||
}, {
|
||||
key: 'getNodeStructure',
|
||||
key: "getNodeStructure",
|
||||
value: function getNodeStructure() {
|
||||
return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(esprima.parse('\n var ' + this.debugProtectionFunctionName + ' = function () {\n function debuggerProtection (counter) {\n if ((\'\' + counter / counter)[\'length\'] !== 1 || counter % 20 === 0) {\n (function () {}.constructor(\'debugger\')());\n } else {\n [].filter.constructor(' + Utils_1.Utils.stringToJSFuck('debugger') + ')();\n }\n \n debuggerProtection(++counter);\n }\n \n try {\n debuggerProtection(0);\n } catch (y) {}\n };\n '));
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure("\n var " + this.debugProtectionFunctionName + " = function () {\n function debuggerProtection (counter) {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n (function () {}.constructor('debugger')());\n } else {\n [].filter.constructor(" + Utils_1.Utils.stringToJSFuck('debugger') + ")();\n }\n \n debuggerProtection(++counter);\n }\n \n try {\n debuggerProtection(0);\n } catch (y) {}\n };\n ");
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1456,25 +1418,29 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var esprima = __webpack_require__(7);
|
||||
var AppendState_1 = __webpack_require__(6);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var JSFuck_1 = __webpack_require__(10);
|
||||
var NoCustomNodesPreset_1 = __webpack_require__(13);
|
||||
var JavaScriptObfuscator_1 = __webpack_require__(9);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
var SelfDefendingUnicodeNode = function (_Node_1$Node) {
|
||||
_inherits(SelfDefendingUnicodeNode, _Node_1$Node);
|
||||
|
||||
function SelfDefendingUnicodeNode(options) {
|
||||
function SelfDefendingUnicodeNode() {
|
||||
var _Object$getPrototypeO;
|
||||
|
||||
_classCallCheck(this, SelfDefendingUnicodeNode);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(SelfDefendingUnicodeNode).call(this, options));
|
||||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(SelfDefendingUnicodeNode)).call.apply(_Object$getPrototypeO, [this].concat(args)));
|
||||
|
||||
_this.appendState = AppendState_1.AppendState.AfterObfuscation;
|
||||
_this.node = _this.getNodeStructure();
|
||||
return _this;
|
||||
}
|
||||
|
||||
@@ -1494,9 +1460,7 @@ var SelfDefendingUnicodeNode = function (_Node_1$Node) {
|
||||
}, {
|
||||
key: "getNodeStructure",
|
||||
value: function getNodeStructure() {
|
||||
var node = esprima.parse(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () { \n var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";},\n func2 = function () {\n return 'window';\n };\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? Function(" + Utils_1.Utils.stringToUnicode("return/(\\\\[x|u](\\w){2,4})+/") + ")().test(func2.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET));
|
||||
NodeUtils_1.NodeUtils.addXVerbatimPropertyToLiterals(node);
|
||||
return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(node);
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () { \n var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";},\n func2 = function () {\n return 'window';\n };\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? Function(" + Utils_1.Utils.stringToUnicode("return/(\\\\[x|u](\\w){2,4})+/") + ")().test(func2.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET));
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1522,9 +1486,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var esprima = __webpack_require__(7);
|
||||
var AppendState_1 = __webpack_require__(6);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
@@ -1540,7 +1503,6 @@ var UnicodeArrayCallsWrapper = function (_Node_1$Node) {
|
||||
_this.unicodeArrayCallsWrapperName = unicodeArrayCallsWrapperName;
|
||||
_this.unicodeArrayName = unicodeArrayName;
|
||||
_this.unicodeArray = unicodeArray;
|
||||
_this.node = _this.getNodeStructure();
|
||||
return _this;
|
||||
}
|
||||
|
||||
@@ -1560,17 +1522,13 @@ var UnicodeArrayCallsWrapper = function (_Node_1$Node) {
|
||||
if (!this.unicodeArray.length) {
|
||||
return;
|
||||
}
|
||||
this.updateNode();
|
||||
return _get(Object.getPrototypeOf(UnicodeArrayCallsWrapper.prototype), "getNode", this).call(this);
|
||||
}
|
||||
}, {
|
||||
key: "getNodeStructure",
|
||||
value: function getNodeStructure() {
|
||||
var keyName = Utils_1.Utils.getRandomVariableName(),
|
||||
node = void 0;
|
||||
node = esprima.parse("\n var " + this.unicodeArrayCallsWrapperName + " = function (" + keyName + ") {\n return " + this.unicodeArrayName + "[parseInt(" + keyName + ", 0x010)];\n };\n ");
|
||||
NodeUtils_1.NodeUtils.addXVerbatimPropertyToLiterals(node);
|
||||
return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(node);
|
||||
var keyName = Utils_1.Utils.getRandomVariableName();
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure("\n var " + this.unicodeArrayCallsWrapperName + " = function (" + keyName + ") {\n return " + this.unicodeArrayName + "[parseInt(" + keyName + ", 0x010)];\n };\n ");
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1596,12 +1554,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var esprima = __webpack_require__(7);
|
||||
var JavaScriptObfuscator_1 = __webpack_require__(9);
|
||||
var AppendState_1 = __webpack_require__(6);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var JSFuck_1 = __webpack_require__(10);
|
||||
var NoCustomNodesPreset_1 = __webpack_require__(13);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
@@ -1616,41 +1573,36 @@ var UnicodeArrayDecodeNode = function (_Node_1$Node) {
|
||||
_this.appendState = AppendState_1.AppendState.AfterObfuscation;
|
||||
_this.unicodeArrayName = unicodeArrayName;
|
||||
_this.unicodeArray = unicodeArray;
|
||||
_this.node = _this.getNodeStructure();
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(UnicodeArrayDecodeNode, [{
|
||||
key: 'appendNode',
|
||||
key: "appendNode",
|
||||
value: function appendNode(blockScopeNode) {
|
||||
NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
|
||||
}
|
||||
}, {
|
||||
key: 'getNode',
|
||||
key: "getNode",
|
||||
value: function getNode() {
|
||||
if (!this.unicodeArray.length) {
|
||||
return;
|
||||
}
|
||||
this.updateNode();
|
||||
return _get(Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), 'getNode', this).call(this);
|
||||
return _get(Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), "getNode", this).call(this);
|
||||
}
|
||||
}, {
|
||||
key: 'getNodeStructure',
|
||||
key: "getNodeStructure",
|
||||
value: function getNodeStructure() {
|
||||
var environmentName = Utils_1.Utils.getRandomVariableName(),
|
||||
forLoopFunctionName = Utils_1.Utils.getRandomVariableName(),
|
||||
indexVariableName = Utils_1.Utils.getRandomVariableName(),
|
||||
tempArrayName = Utils_1.Utils.getRandomVariableName();
|
||||
var code = '',
|
||||
node = void 0;
|
||||
var code = '';
|
||||
if (this.options.get('selfDefending')) {
|
||||
code = '\n var ' + environmentName + ' = function(){return ' + Utils_1.Utils.stringToUnicode('dev') + ';};\n \n Function(' + Utils_1.Utils.stringToUnicode('return/\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}/') + ')()[' + Utils_1.Utils.stringToUnicode('test') + '](' + environmentName + '[' + Utils_1.Utils.stringToUnicode('toString') + ']()) !== ' + JSFuck_1.JSFuck.True + ' && !' + this.unicodeArrayName + '++ ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.True + '){}\')() : Function(' + Utils_1.Utils.stringToUnicode('a') + ', atob(' + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + '))(' + forLoopFunctionName + ') ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.False + '){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(' + JSFuck_1.JSFuck.False + '){}\')();\n ';
|
||||
code = "\n var " + environmentName + " = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";};\n \n Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")()[" + Utils_1.Utils.stringToUnicode('test') + "](" + environmentName + "[" + Utils_1.Utils.stringToUnicode('toString') + "]()) !== " + JSFuck_1.JSFuck.True + " && !" + this.unicodeArrayName + "++ ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : Function(" + Utils_1.Utils.stringToUnicode('a') + ", atob(" + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + "))(" + forLoopFunctionName + ") ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n ";
|
||||
} else {
|
||||
code = forLoopFunctionName + '();';
|
||||
code = forLoopFunctionName + "();";
|
||||
}
|
||||
node = esprima.parse('\n (function () {\n ' + JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate('\n (function () {\n var object = [][\'filter\'][\'constructor\'](\'return this\')();\n var chars = \'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\';\n \n object.atob || (\n object.atob = function(input) {\n var str = String(input).replace(/=+$/, \'\');\n for (\n var bc = 0, bs, buffer, idx = 0, output = \'\';\n buffer = str.charAt(idx++);\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n ', NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET) + '\n \n var ' + forLoopFunctionName + ' = function () {\n var ' + tempArrayName + ' = [];\n \n for (var ' + indexVariableName + ' in ' + this.unicodeArrayName + ') {\n ' + tempArrayName + '[' + Utils_1.Utils.stringToUnicode('push') + '](decodeURI(atob(' + this.unicodeArrayName + '[' + indexVariableName + '])));\n }\n \n ' + this.unicodeArrayName + ' = ' + tempArrayName + ';\n };\n \n ' + code + '\n })();\n ');
|
||||
NodeUtils_1.NodeUtils.addXVerbatimPropertyToLiterals(node);
|
||||
return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(node);
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure("\n (function () {\n " + JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () {\n var object = []['filter']['constructor']('return this')();\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n \n object.atob || (\n object.atob = function(input) {\n var str = String(input).replace(/=+$/, '');\n for (\n var bc = 0, bs, buffer, idx = 0, output = '';\n buffer = str.charAt(idx++);\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET) + "\n \n var " + forLoopFunctionName + " = function () {\n var " + tempArrayName + " = [];\n \n for (var " + indexVariableName + " in " + this.unicodeArrayName + ") {\n " + tempArrayName + "[" + Utils_1.Utils.stringToUnicode('push') + "](decodeURI(atob(" + this.unicodeArrayName + "[" + indexVariableName + "])));\n }\n \n " + this.unicodeArrayName + " = " + tempArrayName + ";\n };\n \n " + code + "\n })();\n ");
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1676,10 +1628,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var escodegen = __webpack_require__(11);
|
||||
var AppendState_1 = __webpack_require__(6);
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
@@ -1698,7 +1648,6 @@ var UnicodeArrayNode = function (_Node_1$Node) {
|
||||
_this.unicodeArray = [];
|
||||
_this.unicodeArrayName = unicodeArrayName;
|
||||
_this.unicodeArrayRotateValue = unicodeArrayRotateValue;
|
||||
_this.node = _this.getNodeStructure();
|
||||
return _this;
|
||||
}
|
||||
|
||||
@@ -1724,7 +1673,6 @@ var UnicodeArrayNode = function (_Node_1$Node) {
|
||||
return;
|
||||
}
|
||||
Utils_1.Utils.arrayRotate(this.unicodeArray, this.unicodeArrayRotateValue);
|
||||
this.updateNode();
|
||||
return _get(Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
|
||||
}
|
||||
}, {
|
||||
@@ -1735,31 +1683,7 @@ var UnicodeArrayNode = function (_Node_1$Node) {
|
||||
}, {
|
||||
key: 'getNodeStructure',
|
||||
value: function getNodeStructure() {
|
||||
return {
|
||||
'type': NodeType_1.NodeType.VariableDeclaration,
|
||||
'declarations': [{
|
||||
'type': NodeType_1.NodeType.VariableDeclarator,
|
||||
'id': {
|
||||
'type': NodeType_1.NodeType.Identifier,
|
||||
'name': this.unicodeArrayName
|
||||
},
|
||||
'init': {
|
||||
'type': NodeType_1.NodeType.ArrayExpression,
|
||||
'elements': this.unicodeArray.map(function (value) {
|
||||
return {
|
||||
'type': NodeType_1.NodeType.Literal,
|
||||
'value': value,
|
||||
'raw': '\'' + value + '\'',
|
||||
'x-verbatim-property': {
|
||||
'content': value,
|
||||
precedence: escodegen.Precedence.Primary
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
}],
|
||||
'kind': 'var'
|
||||
};
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure('\n var ' + this.unicodeArrayName + ' = [' + this.unicodeArray.join(',') + '];\n ');
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -1786,12 +1710,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var esprima = __webpack_require__(7);
|
||||
var AppendState_1 = __webpack_require__(6);
|
||||
var AppendState_1 = __webpack_require__(2);
|
||||
var JSFuck_1 = __webpack_require__(10);
|
||||
var NoCustomNodesPreset_1 = __webpack_require__(13);
|
||||
var JavaScriptObfuscator_1 = __webpack_require__(9);
|
||||
var Node_1 = __webpack_require__(4);
|
||||
var Node_1 = __webpack_require__(5);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
@@ -1807,7 +1730,6 @@ var UnicodeArrayRotateFunctionNode = function (_Node_1$Node) {
|
||||
_this.unicodeArrayName = unicodeArrayName;
|
||||
_this.unicodeArray = unicodeArray;
|
||||
_this.unicodeArrayRotateValue = unicodeArrayRotateValue;
|
||||
_this.node = _this.getNodeStructure();
|
||||
return _this;
|
||||
}
|
||||
|
||||
@@ -1831,16 +1753,13 @@ var UnicodeArrayRotateFunctionNode = function (_Node_1$Node) {
|
||||
code = '',
|
||||
timesName = Utils_1.Utils.getRandomVariableName(),
|
||||
timesArgumentName = Utils_1.Utils.getRandomVariableName(),
|
||||
whileFunctionName = Utils_1.Utils.getRandomVariableName(),
|
||||
node = void 0;
|
||||
whileFunctionName = Utils_1.Utils.getRandomVariableName();
|
||||
if (this.options.get('selfDefending')) {
|
||||
code = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate("\n (function () {\n var func = function(){return " + Utils_1.Utils.stringToUnicode('dev') + ";};\n \n !Function(" + Utils_1.Utils.stringToUnicode("return/\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}/") + ")().test(func.toString()) ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.True + "){}')() : Function(" + Utils_1.Utils.stringToUnicode('a') + ", " + Utils_1.Utils.stringToUnicode('b') + ", " + Utils_1.Utils.stringToUnicode('a(++b)') + ")(" + whileFunctionName + ", " + timesName + ") ? []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')() : []['filter']['constructor'](" + Utils_1.Utils.stringToJSFuck('while') + " + '(" + JSFuck_1.JSFuck.False + "){}')();\n })();\n ", NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET);
|
||||
} else {
|
||||
code = whileFunctionName + "(++" + timesName + ")";
|
||||
}
|
||||
node = esprima.parse("\n (function (" + arrayName + ", " + timesName + ") {\n var " + whileFunctionName + " = function (" + timesArgumentName + ") {\n while (--" + timesArgumentName + ") {\n " + arrayName + "[" + Utils_1.Utils.stringToUnicode('push') + "](" + arrayName + "[" + Utils_1.Utils.stringToUnicode('shift') + "]());\n }\n };\n \n " + code + "\n })(" + this.unicodeArrayName + ", 0x" + Utils_1.Utils.decToHex(this.unicodeArrayRotateValue) + ");\n ");
|
||||
NodeUtils_1.NodeUtils.addXVerbatimPropertyToLiterals(node);
|
||||
return NodeUtils_1.NodeUtils.getBlockStatementNodeByIndex(node);
|
||||
return NodeUtils_1.NodeUtils.convertCodeToStructure("\n (function (" + arrayName + ", " + timesName + ") {\n var " + whileFunctionName + " = function (" + timesArgumentName + ") {\n while (--" + timesArgumentName + ") {\n " + arrayName + "[" + Utils_1.Utils.stringToUnicode('push') + "](" + arrayName + "[" + Utils_1.Utils.stringToUnicode('shift') + "]());\n }\n };\n \n " + code + "\n })(" + this.unicodeArrayName + ", 0x" + Utils_1.Utils.decToHex(this.unicodeArrayRotateValue) + ");\n ");
|
||||
}
|
||||
}]);
|
||||
|
||||
@@ -2041,8 +1960,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeObfuscator_1 = __webpack_require__(5);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var NodeObfuscator_1 = __webpack_require__(6);
|
||||
|
||||
var CatchClauseObfuscator = function (_NodeObfuscator_1$Nod) {
|
||||
_inherits(CatchClauseObfuscator, _NodeObfuscator_1$Nod);
|
||||
@@ -2112,9 +2031,9 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var NodeObfuscator_1 = __webpack_require__(5);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var NodeType_1 = __webpack_require__(3);
|
||||
var NodeObfuscator_1 = __webpack_require__(6);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
|
||||
var FunctionDeclarationObfuscator = function (_NodeObfuscator_1$Nod) {
|
||||
@@ -2189,8 +2108,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeObfuscator_1 = __webpack_require__(5);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var NodeObfuscator_1 = __webpack_require__(6);
|
||||
|
||||
var FunctionObfuscator = function (_NodeObfuscator_1$Nod) {
|
||||
_inherits(FunctionObfuscator, _NodeObfuscator_1$Nod);
|
||||
@@ -2269,7 +2188,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var escodegen = __webpack_require__(11);
|
||||
var NodeObfuscator_1 = __webpack_require__(5);
|
||||
var NodeObfuscator_1 = __webpack_require__(6);
|
||||
var Nodes_1 = __webpack_require__(8);
|
||||
|
||||
var LiteralObfuscator = function (_NodeObfuscator_1$Nod) {
|
||||
@@ -2332,9 +2251,9 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var escodegen = __webpack_require__(11);
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var NodeObfuscator_1 = __webpack_require__(5);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var NodeType_1 = __webpack_require__(3);
|
||||
var NodeObfuscator_1 = __webpack_require__(6);
|
||||
var Nodes_1 = __webpack_require__(8);
|
||||
|
||||
var MemberExpressionObfuscator = function (_NodeObfuscator_1$Nod) {
|
||||
@@ -2415,8 +2334,8 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeObfuscator_1 = __webpack_require__(5);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var NodeObfuscator_1 = __webpack_require__(6);
|
||||
var Nodes_1 = __webpack_require__(8);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
@@ -2482,9 +2401,9 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var escodegen = __webpack_require__(11);
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var NodeObfuscator_1 = __webpack_require__(5);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var NodeType_1 = __webpack_require__(3);
|
||||
var NodeObfuscator_1 = __webpack_require__(6);
|
||||
var Nodes_1 = __webpack_require__(8);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
@@ -2564,9 +2483,9 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var estraverse = __webpack_require__(3);
|
||||
var NodeType_1 = __webpack_require__(2);
|
||||
var NodeObfuscator_1 = __webpack_require__(5);
|
||||
var estraverse = __webpack_require__(4);
|
||||
var NodeType_1 = __webpack_require__(3);
|
||||
var NodeObfuscator_1 = __webpack_require__(6);
|
||||
var NodeUtils_1 = __webpack_require__(1);
|
||||
var Utils_1 = __webpack_require__(0);
|
||||
|
||||
|
||||
+18
-1
@@ -1,3 +1,5 @@
|
||||
import * as escodegen from 'escodegen';
|
||||
import * as esprima from 'esprima';
|
||||
import * as estraverse from 'estraverse';
|
||||
|
||||
import { INode } from './interfaces/nodes/INode';
|
||||
@@ -29,7 +31,10 @@ export class NodeUtils {
|
||||
estraverse.replace(node, {
|
||||
enter: (node: INode, parentNode: INode): any => {
|
||||
if (Nodes.isLiteralNode(node)) {
|
||||
node['x-verbatim-property'] = node.raw;
|
||||
node['x-verbatim-property'] = {
|
||||
content : node.raw,
|
||||
precedence: escodegen.Precedence.Primary
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -47,6 +52,18 @@ export class NodeUtils {
|
||||
blockScopeBody.push(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* @returns {INode}
|
||||
*/
|
||||
public static convertCodeToStructure (code: string): INode {
|
||||
let structure: INode = esprima.parse(code);
|
||||
|
||||
NodeUtils.addXVerbatimPropertyToLiterals(structure);
|
||||
|
||||
return NodeUtils.getBlockStatementNodeByIndex(structure);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param node
|
||||
* @param index
|
||||
|
||||
@@ -8,14 +8,11 @@ import { NodeUtils } from "../NodeUtils";
|
||||
|
||||
export abstract class Node implements ICustomNode {
|
||||
/**
|
||||
* TODO: add `abstract` modifier
|
||||
*
|
||||
* @type {AppendState}
|
||||
*/
|
||||
protected appendState: AppendState = AppendState.BeforeObfuscation;
|
||||
|
||||
/**
|
||||
* @type {INode}
|
||||
*/
|
||||
protected node: INode;
|
||||
protected appendState: AppendState;
|
||||
|
||||
/**
|
||||
* @type {IOptions}
|
||||
@@ -39,23 +36,14 @@ export abstract class Node implements ICustomNode {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns any
|
||||
* @returns {INode}
|
||||
*/
|
||||
public getNode (): INode {
|
||||
NodeUtils.parentize(this.node);
|
||||
let node: INode = this.getNodeStructure();
|
||||
|
||||
return this.node;
|
||||
}
|
||||
NodeUtils.parentize(node);
|
||||
|
||||
/**
|
||||
* @param node
|
||||
*/
|
||||
public setNode (node: INode): void {
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
public updateNode (): void {
|
||||
this.node = this.getNodeStructure();
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
import * as esprima from 'esprima';
|
||||
|
||||
import { INode } from "../../interfaces/nodes/INode";
|
||||
import { IOptions } from "../../interfaces/IOptions";
|
||||
|
||||
import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
|
||||
|
||||
import { AppendState } from "../../enums/AppendState";
|
||||
|
||||
import { Node } from '../Node';
|
||||
import { NodeUtils } from "../../NodeUtils";
|
||||
|
||||
export class ConsoleOutputDisableExpressionNode extends Node {
|
||||
/**
|
||||
* @param options
|
||||
* @type {AppendState}
|
||||
*/
|
||||
constructor (options: IOptions) {
|
||||
super(options);
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
protected appendState: AppendState = AppendState.BeforeObfuscation;
|
||||
|
||||
/**
|
||||
* @param blockScopeNode
|
||||
@@ -42,21 +39,19 @@ export class ConsoleOutputDisableExpressionNode extends Node {
|
||||
* @returns {INode}
|
||||
*/
|
||||
protected getNodeStructure (): INode {
|
||||
return NodeUtils.getBlockStatementNodeByIndex(
|
||||
esprima.parse(`
|
||||
(function () {
|
||||
var _ = '(\u0004\u0006\u0003\u0005[]' + '["filter"]["\u0007tructor"]' + '("return this")()' + '.' + '\u0003;\u0006\u0002\u0005\u0004};' + '_\u0003.log\u0001.in' + 'fo\u0001.' + 'war' + 'n\u0001.er' + 'r' + 'or\u0001})();' + '\u0001\u0005_\u0002;' + '_\u0003\u0002function' + '\u0003\u0007ole\u0004\u0002 ()' + '{\u0005 = \u0006var ' + '_\u0007cons',
|
||||
Y,
|
||||
$;
|
||||
|
||||
for (Y in $ = "\u0007\u0006\u0005\u0004\u0003\u0002\u0001") {
|
||||
var arr = _.split($[Y]);
|
||||
_ = arr.join(arr.pop());
|
||||
}
|
||||
|
||||
[]["filter"]["constructor"](_)();
|
||||
})()
|
||||
`)
|
||||
);
|
||||
return NodeUtils.convertCodeToStructure(`
|
||||
(function () {
|
||||
var _ = '(\u0004\u0006\u0003\u0005[]' + '["filter"]["\u0007tructor"]' + '("return this")()' + '.' + '\u0003;\u0006\u0002\u0005\u0004};' + '_\u0003.log\u0001.in' + 'fo\u0001.' + 'war' + 'n\u0001.er' + 'r' + 'or\u0001})();' + '\u0001\u0005_\u0002;' + '_\u0003\u0002function' + '\u0003\u0007ole\u0004\u0002 ()' + '{\u0005 = \u0006var ' + '_\u0007cons',
|
||||
Y,
|
||||
$;
|
||||
|
||||
for (Y in $ = "\u0007\u0006\u0005\u0004\u0003\u0002\u0001") {
|
||||
var arr = _.split($[Y]);
|
||||
_ = arr.join(arr.pop());
|
||||
}
|
||||
|
||||
[]["filter"]["constructor"](_)();
|
||||
})()
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
import { IExpressionStatementNode } from "../../interfaces/nodes/IExpressionStatementNode";
|
||||
import { INode } from "../../interfaces/nodes/INode";
|
||||
import { IOptions } from "../../interfaces/IOptions";
|
||||
|
||||
import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
|
||||
|
||||
import { NodeType } from "../../enums/NodeType";
|
||||
import { AppendState } from "../../enums/AppendState";
|
||||
|
||||
import { Node } from '../Node';
|
||||
import { NodeUtils } from "../../NodeUtils";
|
||||
|
||||
export class DebugProtectionFunctionCallNode extends Node {
|
||||
/**
|
||||
* @type {AppendState}
|
||||
*/
|
||||
protected appendState: AppendState = AppendState.BeforeObfuscation;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
@@ -22,8 +27,6 @@ export class DebugProtectionFunctionCallNode extends Node {
|
||||
super(options);
|
||||
|
||||
this.debugProtectionFunctionName = debugProtectionFunctionName;
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,19 +37,11 @@ export class DebugProtectionFunctionCallNode extends Node {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {IExpressionStatementNode}
|
||||
* @returns {INode}
|
||||
*/
|
||||
protected getNodeStructure (): IExpressionStatementNode {
|
||||
return {
|
||||
'type': NodeType.ExpressionStatement,
|
||||
'expression': {
|
||||
'type': NodeType.CallExpression,
|
||||
'callee': {
|
||||
'type': NodeType.Identifier,
|
||||
'name': this.debugProtectionFunctionName
|
||||
},
|
||||
'arguments': []
|
||||
}
|
||||
};
|
||||
protected getNodeStructure (): INode {
|
||||
return NodeUtils.convertCodeToStructure(`
|
||||
${this.debugProtectionFunctionName}();
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
import { IExpressionStatementNode } from "../../interfaces/nodes/IExpressionStatementNode";
|
||||
import { INode } from "../../interfaces/nodes/INode";
|
||||
import { IOptions } from "../../interfaces/IOptions";
|
||||
|
||||
import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
|
||||
|
||||
import { NodeType } from '../../enums/NodeType';
|
||||
import { AppendState } from "../../enums/AppendState";
|
||||
|
||||
import { Node } from '../Node';
|
||||
import { NodeUtils } from '../../NodeUtils';
|
||||
|
||||
export class DebugProtectionFunctionIntervalNode extends Node {
|
||||
/**
|
||||
* @type {AppendState}
|
||||
*/
|
||||
protected appendState: AppendState = AppendState.BeforeObfuscation;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
@@ -22,8 +27,6 @@ export class DebugProtectionFunctionIntervalNode extends Node {
|
||||
super(options);
|
||||
|
||||
this.debugProtectionFunctionName = debugProtectionFunctionName;
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,49 +37,13 @@ export class DebugProtectionFunctionIntervalNode extends Node {
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {IExpressionStatementNode}
|
||||
* @returns {INode}
|
||||
*/
|
||||
protected getNodeStructure (): IExpressionStatementNode {
|
||||
return {
|
||||
'type': NodeType.ExpressionStatement,
|
||||
'expression': {
|
||||
'type': NodeType.CallExpression,
|
||||
'callee': {
|
||||
'type': NodeType.Identifier,
|
||||
'name': 'setInterval'
|
||||
},
|
||||
'arguments': [
|
||||
{
|
||||
'type': NodeType.FunctionExpression,
|
||||
'id': null,
|
||||
'params': [],
|
||||
'defaults': [],
|
||||
'body': {
|
||||
'type': NodeType.BlockStatement,
|
||||
'body': [
|
||||
{
|
||||
'type': NodeType.ExpressionStatement,
|
||||
'expression': {
|
||||
'type': NodeType.CallExpression,
|
||||
'callee': {
|
||||
'type': NodeType.Identifier,
|
||||
'name': this.debugProtectionFunctionName
|
||||
},
|
||||
'arguments': []
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
'generator': false,
|
||||
'expression': false
|
||||
},
|
||||
{
|
||||
'type': NodeType.Literal,
|
||||
'value': 4000,
|
||||
'raw': '4000'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
protected getNodeStructure (): INode {
|
||||
return NodeUtils.convertCodeToStructure(`
|
||||
setInterval(function () {
|
||||
${this.debugProtectionFunctionName}();
|
||||
}, 4000);
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import * as esprima from 'esprima';
|
||||
|
||||
import { INode } from "../../interfaces/nodes/INode";
|
||||
import { IOptions } from "../../interfaces/IOptions";
|
||||
|
||||
import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
|
||||
|
||||
import { AppendState } from "../../enums/AppendState";
|
||||
|
||||
import { Node } from '../Node';
|
||||
import { NodeUtils } from '../../NodeUtils';
|
||||
import { Utils } from "../../Utils";
|
||||
|
||||
export class DebugProtectionFunctionNode extends Node {
|
||||
/**
|
||||
* @type {AppendState}
|
||||
*/
|
||||
protected appendState: AppendState = AppendState.BeforeObfuscation;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
@@ -23,8 +28,6 @@ export class DebugProtectionFunctionNode extends Node {
|
||||
super(options);
|
||||
|
||||
this.debugProtectionFunctionName = debugProtectionFunctionName;
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,24 +56,22 @@ export class DebugProtectionFunctionNode extends Node {
|
||||
* @returns {INode}
|
||||
*/
|
||||
protected getNodeStructure (): INode {
|
||||
return NodeUtils.getBlockStatementNodeByIndex(
|
||||
esprima.parse(`
|
||||
var ${this.debugProtectionFunctionName} = function () {
|
||||
function debuggerProtection (counter) {
|
||||
if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {
|
||||
(function () {}.constructor('debugger')());
|
||||
} else {
|
||||
[].filter.constructor(${Utils.stringToJSFuck('debugger')})();
|
||||
}
|
||||
|
||||
debuggerProtection(++counter);
|
||||
return NodeUtils.convertCodeToStructure(`
|
||||
var ${this.debugProtectionFunctionName} = function () {
|
||||
function debuggerProtection (counter) {
|
||||
if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {
|
||||
(function () {}.constructor('debugger')());
|
||||
} else {
|
||||
[].filter.constructor(${Utils.stringToJSFuck('debugger')})();
|
||||
}
|
||||
|
||||
try {
|
||||
debuggerProtection(0);
|
||||
} catch (y) {}
|
||||
};
|
||||
`)
|
||||
);
|
||||
debuggerProtection(++counter);
|
||||
}
|
||||
|
||||
try {
|
||||
debuggerProtection(0);
|
||||
} catch (y) {}
|
||||
};
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import * as esprima from 'esprima';
|
||||
|
||||
import { INode } from "../../interfaces/nodes/INode";
|
||||
import { IOptions } from "../../interfaces/IOptions";
|
||||
|
||||
import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
|
||||
|
||||
@@ -21,15 +18,6 @@ export class SelfDefendingUnicodeNode extends Node {
|
||||
*/
|
||||
protected appendState: AppendState = AppendState.AfterObfuscation;
|
||||
|
||||
/**
|
||||
* @param options
|
||||
*/
|
||||
constructor (options: IOptions) {
|
||||
super(options);
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param blockScopeNode
|
||||
*/
|
||||
@@ -51,7 +39,7 @@ export class SelfDefendingUnicodeNode extends Node {
|
||||
* @returns {INode}
|
||||
*/
|
||||
protected getNodeStructure (): INode {
|
||||
let node: INode = esprima.parse(
|
||||
return NodeUtils.convertCodeToStructure(
|
||||
JavaScriptObfuscator.obfuscate(`
|
||||
(function () {
|
||||
var func = function(){return ${Utils.stringToUnicode('dev')};},
|
||||
@@ -63,9 +51,5 @@ export class SelfDefendingUnicodeNode extends Node {
|
||||
})();
|
||||
`, NO_CUSTOM_NODES_PRESET)
|
||||
);
|
||||
|
||||
NodeUtils.addXVerbatimPropertyToLiterals(node);
|
||||
|
||||
return NodeUtils.getBlockStatementNodeByIndex(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import * as esprima from 'esprima';
|
||||
|
||||
import { INode } from "../../interfaces/nodes/INode";
|
||||
import { IOptions } from "../../interfaces/IOptions";
|
||||
|
||||
@@ -49,8 +47,6 @@ export class UnicodeArrayCallsWrapper extends Node {
|
||||
this.unicodeArrayCallsWrapperName = unicodeArrayCallsWrapperName;
|
||||
this.unicodeArrayName = unicodeArrayName;
|
||||
this.unicodeArray = unicodeArray;
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,8 +71,6 @@ export class UnicodeArrayCallsWrapper extends Node {
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateNode();
|
||||
|
||||
return super.getNode();
|
||||
}
|
||||
|
||||
@@ -84,17 +78,12 @@ export class UnicodeArrayCallsWrapper extends Node {
|
||||
* @returns {INode}
|
||||
*/
|
||||
protected getNodeStructure (): INode {
|
||||
let keyName: string = Utils.getRandomVariableName(),
|
||||
node: INode;
|
||||
let keyName: string = Utils.getRandomVariableName();
|
||||
|
||||
node = esprima.parse(`
|
||||
return NodeUtils.convertCodeToStructure(`
|
||||
var ${this.unicodeArrayCallsWrapperName} = function (${keyName}) {
|
||||
return ${this.unicodeArrayName}[parseInt(${keyName}, 0x010)];
|
||||
};
|
||||
`);
|
||||
|
||||
NodeUtils.addXVerbatimPropertyToLiterals(node);
|
||||
|
||||
return NodeUtils.getBlockStatementNodeByIndex(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as esprima from 'esprima';
|
||||
import { JavaScriptObfuscator } from '../../JavaScriptObfuscator';
|
||||
|
||||
import { INode } from "../../interfaces/nodes/INode";
|
||||
@@ -45,8 +44,6 @@ export class UnicodeArrayDecodeNode extends Node {
|
||||
|
||||
this.unicodeArrayName = unicodeArrayName;
|
||||
this.unicodeArray = unicodeArray;
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,8 +61,6 @@ export class UnicodeArrayDecodeNode extends Node {
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateNode();
|
||||
|
||||
return super.getNode();
|
||||
}
|
||||
|
||||
@@ -78,8 +73,7 @@ export class UnicodeArrayDecodeNode extends Node {
|
||||
indexVariableName: string = Utils.getRandomVariableName(),
|
||||
tempArrayName: string = Utils.getRandomVariableName();
|
||||
|
||||
let code: string = '',
|
||||
node: INode;
|
||||
let code: string = '';
|
||||
|
||||
if (this.options.get('selfDefending')) {
|
||||
code = `
|
||||
@@ -91,7 +85,7 @@ export class UnicodeArrayDecodeNode extends Node {
|
||||
code = `${forLoopFunctionName}();`;
|
||||
}
|
||||
|
||||
node = esprima.parse(`
|
||||
return NodeUtils.convertCodeToStructure(`
|
||||
(function () {
|
||||
${JavaScriptObfuscator.obfuscate(`
|
||||
(function () {
|
||||
@@ -127,9 +121,5 @@ export class UnicodeArrayDecodeNode extends Node {
|
||||
${code}
|
||||
})();
|
||||
`);
|
||||
|
||||
NodeUtils.addXVerbatimPropertyToLiterals(node);
|
||||
|
||||
return NodeUtils.getBlockStatementNodeByIndex(node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import * as escodegen from 'escodegen';
|
||||
|
||||
import { INode } from '../../interfaces/nodes/INode';
|
||||
import { IOptions } from "../../interfaces/IOptions";
|
||||
import { IVariableDeclarationNode } from "../../interfaces/nodes/IVariableDeclarationNode";
|
||||
|
||||
import { TNodeWithBlockStatement } from "../../types/TNodeWithBlockStatement";
|
||||
|
||||
import { AppendState } from '../../enums/AppendState';
|
||||
import { NodeType } from "../../enums/NodeType";
|
||||
|
||||
import { Node } from '../Node';
|
||||
import { NodeUtils } from "../../NodeUtils";
|
||||
@@ -53,8 +49,6 @@ export class UnicodeArrayNode extends Node {
|
||||
|
||||
this.unicodeArrayName = unicodeArrayName;
|
||||
this.unicodeArrayRotateValue = unicodeArrayRotateValue;
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,8 +82,6 @@ export class UnicodeArrayNode extends Node {
|
||||
|
||||
Utils.arrayRotate <string> (this.unicodeArray, this.unicodeArrayRotateValue);
|
||||
|
||||
this.updateNode();
|
||||
|
||||
return super.getNode();
|
||||
}
|
||||
|
||||
@@ -103,33 +95,9 @@ export class UnicodeArrayNode extends Node {
|
||||
/**
|
||||
* @returns {INode}
|
||||
*/
|
||||
protected getNodeStructure (): IVariableDeclarationNode {
|
||||
return {
|
||||
'type': NodeType.VariableDeclaration,
|
||||
'declarations': [
|
||||
{
|
||||
'type': NodeType.VariableDeclarator,
|
||||
'id': {
|
||||
'type': NodeType.Identifier,
|
||||
'name': this.unicodeArrayName
|
||||
},
|
||||
'init': {
|
||||
'type': NodeType.ArrayExpression,
|
||||
'elements': this.unicodeArray.map((value: string) => {
|
||||
return {
|
||||
'type': NodeType.Literal,
|
||||
'value': value,
|
||||
'raw': `'${value}'`,
|
||||
'x-verbatim-property': {
|
||||
'content' : value,
|
||||
precedence: escodegen.Precedence.Primary
|
||||
}
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
],
|
||||
'kind': 'var'
|
||||
};
|
||||
protected getNodeStructure (): INode {
|
||||
return NodeUtils.convertCodeToStructure(`
|
||||
var ${this.unicodeArrayName} = [${this.unicodeArray.join(',')}];
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import * as esprima from 'esprima';
|
||||
|
||||
import { INode } from "../../interfaces/nodes/INode";
|
||||
import { IOptions } from "../../interfaces/IOptions";
|
||||
|
||||
@@ -53,8 +51,6 @@ export class UnicodeArrayRotateFunctionNode extends Node {
|
||||
this.unicodeArrayName = unicodeArrayName;
|
||||
this.unicodeArray = unicodeArray;
|
||||
this.unicodeArrayRotateValue = unicodeArrayRotateValue;
|
||||
|
||||
this.node = this.getNodeStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,8 +79,7 @@ export class UnicodeArrayRotateFunctionNode extends Node {
|
||||
code: string = '',
|
||||
timesName: string = Utils.getRandomVariableName(),
|
||||
timesArgumentName: string = Utils.getRandomVariableName(),
|
||||
whileFunctionName: string = Utils.getRandomVariableName(),
|
||||
node: INode;
|
||||
whileFunctionName: string = Utils.getRandomVariableName();
|
||||
|
||||
if (this.options.get('selfDefending')) {
|
||||
code = JavaScriptObfuscator.obfuscate(`
|
||||
@@ -98,7 +93,7 @@ export class UnicodeArrayRotateFunctionNode extends Node {
|
||||
code = `${whileFunctionName}(++${timesName})`;
|
||||
}
|
||||
|
||||
node = esprima.parse(`
|
||||
return NodeUtils.convertCodeToStructure(`
|
||||
(function (${arrayName}, ${timesName}) {
|
||||
var ${whileFunctionName} = function (${timesArgumentName}) {
|
||||
while (--${timesArgumentName}) {
|
||||
@@ -109,9 +104,5 @@ export class UnicodeArrayRotateFunctionNode extends Node {
|
||||
${code}
|
||||
})(${this.unicodeArrayName}, 0x${Utils.decToHex(this.unicodeArrayRotateValue)});
|
||||
`);
|
||||
|
||||
NodeUtils.addXVerbatimPropertyToLiterals(node);
|
||||
|
||||
return NodeUtils.getBlockStatementNodeByIndex(node);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-7
@@ -28,13 +28,6 @@ export interface ICustomNode {
|
||||
*/
|
||||
getNodeData ? (): any;
|
||||
|
||||
/**
|
||||
* @param node
|
||||
*/
|
||||
setNode (node: INode): void;
|
||||
|
||||
updateNode (): void;
|
||||
|
||||
/**
|
||||
* @param data
|
||||
*/
|
||||
|
||||
+13
-8
@@ -17,9 +17,9 @@ describe('NodeUtils', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
literalNode = NodeMocks.getLiteralNode();
|
||||
delete literalNode['x-verbatim-property'];
|
||||
|
||||
expectedLiteralNode = Object.assign({}, literalNode);
|
||||
expectedLiteralNode['x-verbatim-property'] = `'string'`;
|
||||
expectedLiteralNode = NodeMocks.getLiteralNode();
|
||||
|
||||
NodeUtils.addXVerbatimPropertyToLiterals(literalNode);
|
||||
});
|
||||
@@ -39,8 +39,9 @@ describe('NodeUtils', () => {
|
||||
|
||||
blockStatementNode = NodeMocks.getBlockStatementNode();
|
||||
|
||||
expectedBlockStatementNode = Object.assign({}, blockStatementNode);
|
||||
expectedBlockStatementNode.body.push(expressionStatementNode);
|
||||
expectedBlockStatementNode = NodeMocks.getBlockStatementNode([
|
||||
expressionStatementNode
|
||||
]);
|
||||
|
||||
NodeUtils.appendNode(blockStatementNode.body, expressionStatementNode);
|
||||
});
|
||||
@@ -173,8 +174,10 @@ describe('NodeUtils', () => {
|
||||
expressionStatementNode1
|
||||
]);
|
||||
|
||||
expectedBlockStatementNode = Object.assign({}, blockStatementNode);
|
||||
expectedBlockStatementNode['body'].push(expressionStatementNode2);
|
||||
expectedBlockStatementNode = NodeMocks.getBlockStatementNode([
|
||||
expressionStatementNode1,
|
||||
expressionStatementNode1
|
||||
]);
|
||||
|
||||
NodeUtils.insertNodeAtIndex(blockStatementNode.body, expressionStatementNode2, 1);
|
||||
});
|
||||
@@ -245,8 +248,10 @@ describe('NodeUtils', () => {
|
||||
expressionStatementNode1
|
||||
]);
|
||||
|
||||
expectedBlockStatementNode = Object.assign({}, blockStatementNode);
|
||||
expectedBlockStatementNode['body'].unshift(expressionStatementNode2);
|
||||
expectedBlockStatementNode = NodeMocks.getBlockStatementNode([
|
||||
expressionStatementNode2,
|
||||
expressionStatementNode1
|
||||
]);
|
||||
|
||||
NodeUtils.prependNode(blockStatementNode.body, expressionStatementNode2);
|
||||
});
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as escodegen from 'escodegen';
|
||||
|
||||
import { TStatement } from "../../src/types/nodes/TStatement";
|
||||
|
||||
import { IBlockStatementNode } from "../../src/interfaces/nodes/IBlockStatementNode";
|
||||
@@ -108,7 +110,10 @@ export class NodeMocks {
|
||||
type: NodeType.Literal,
|
||||
value: 'string',
|
||||
raw: `'string'`,
|
||||
'x-verbatim-property': `'string'`
|
||||
'x-verbatim-property': {
|
||||
content: `'string'`,
|
||||
precedence: escodegen.Precedence.Primary
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user