js-confuser 1.7.2 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/node.js.yml +1 -1
- package/CHANGELOG.md +35 -0
- package/README.md +20 -4
- package/dist/constants.js +7 -2
- package/dist/index.js +8 -0
- package/dist/options.js +12 -2
- package/dist/templates/bufferToString.js +26 -5
- package/dist/templates/core.js +35 -0
- package/dist/templates/crash.js +8 -39
- package/dist/templates/es5.js +1 -1
- package/dist/templates/functionLength.js +1 -1
- package/dist/templates/globals.js +1 -1
- package/dist/templates/template.js +173 -68
- package/dist/transforms/antiTooling.js +1 -1
- package/dist/transforms/calculator.js +2 -2
- package/dist/transforms/controlFlowFlattening/controlFlowFlattening.js +8 -2
- package/dist/transforms/controlFlowFlattening/expressionObfuscation.js +1 -1
- package/dist/transforms/deadCode.js +34 -24
- package/dist/transforms/dispatcher.js +8 -4
- package/dist/transforms/es5/antiClass.js +11 -11
- package/dist/transforms/es5/antiDestructuring.js +1 -1
- package/dist/transforms/es5/antiES6Object.js +2 -2
- package/dist/transforms/es5/antiTemplate.js +1 -1
- package/dist/transforms/extraction/duplicateLiteralsRemoval.js +2 -2
- package/dist/transforms/identifier/globalAnalysis.js +13 -0
- package/dist/transforms/identifier/globalConcealing.js +41 -6
- package/dist/transforms/identifier/renameVariables.js +7 -0
- package/dist/transforms/lock/antiDebug.js +2 -2
- package/dist/transforms/lock/integrity.js +9 -9
- package/dist/transforms/lock/lock.js +106 -20
- package/dist/transforms/minify.js +1 -1
- package/dist/transforms/opaquePredicates.js +2 -2
- package/dist/transforms/preparation.js +12 -0
- package/dist/transforms/rgf.js +32 -3
- package/dist/transforms/shuffle.js +3 -3
- package/dist/transforms/stack.js +8 -2
- package/dist/transforms/string/encoding.js +6 -3
- package/dist/transforms/string/stringCompression.js +34 -3
- package/dist/transforms/string/stringConcealing.js +7 -6
- package/dist/transforms/transform.js +26 -4
- package/dist/util/guard.js +5 -0
- package/dist/util/random.js +26 -0
- package/docs/Countermeasures.md +13 -6
- package/docs/Integrity.md +35 -28
- package/docs/RGF.md +6 -1
- package/docs/RenameVariables.md +116 -0
- package/docs/TamperProtection.md +100 -0
- package/docs/Template.md +117 -0
- package/package.json +1 -1
- package/src/constants.ts +5 -0
- package/src/index.ts +7 -5
- package/src/options.ts +47 -7
- package/src/templates/bufferToString.ts +34 -4
- package/src/templates/core.ts +29 -0
- package/src/templates/crash.ts +6 -38
- package/src/templates/es5.ts +1 -1
- package/src/templates/functionLength.ts +1 -1
- package/src/templates/globals.ts +1 -1
- package/src/templates/template.ts +185 -86
- package/src/transforms/antiTooling.ts +1 -1
- package/src/transforms/calculator.ts +4 -2
- package/src/transforms/controlFlowFlattening/controlFlowFlattening.ts +10 -3
- package/src/transforms/controlFlowFlattening/expressionObfuscation.ts +1 -1
- package/src/transforms/deadCode.ts +74 -26
- package/src/transforms/dispatcher.ts +9 -5
- package/src/transforms/es5/antiClass.ts +15 -11
- package/src/transforms/es5/antiDestructuring.ts +1 -1
- package/src/transforms/es5/antiES6Object.ts +2 -2
- package/src/transforms/es5/antiTemplate.ts +1 -1
- package/src/transforms/extraction/duplicateLiteralsRemoval.ts +2 -6
- package/src/transforms/identifier/globalAnalysis.ts +18 -1
- package/src/transforms/identifier/globalConcealing.ts +94 -11
- package/src/transforms/identifier/renameVariables.ts +16 -1
- package/src/transforms/lock/antiDebug.ts +2 -2
- package/src/transforms/lock/integrity.ts +13 -11
- package/src/transforms/lock/lock.ts +122 -30
- package/src/transforms/minify.ts +1 -1
- package/src/transforms/opaquePredicates.ts +2 -2
- package/src/transforms/preparation.ts +16 -0
- package/src/transforms/rgf.ts +46 -8
- package/src/transforms/shuffle.ts +3 -3
- package/src/transforms/stack.ts +9 -3
- package/src/transforms/string/encoding.ts +10 -7
- package/src/transforms/string/stringCompression.ts +81 -9
- package/src/transforms/string/stringConcealing.ts +10 -6
- package/src/transforms/transform.ts +35 -47
- package/src/types.ts +2 -0
- package/src/util/guard.ts +10 -0
- package/src/util/random.ts +81 -1
- package/test/code/Cash.test.ts +84 -1
- package/test/compare.test.ts +5 -5
- package/test/options.test.ts +18 -0
- package/test/templates/template.test.ts +211 -1
- package/test/transforms/identifier/globalConcealing.test.ts +70 -0
- package/test/transforms/identifier/renameVariables.test.ts +75 -1
- package/test/transforms/lock/tamperProtection.test.ts +336 -0
|
@@ -58,7 +58,7 @@ class Calculator extends _transform.default {
|
|
|
58
58
|
});
|
|
59
59
|
var func = (0, _gen.FunctionDeclaration)(this.calculatorFn, [leftArg, rightArg].map(x => (0, _gen.Identifier)(x)), [(0, _gen.SwitchStatement)((0, _gen.Identifier)(this.calculatorOpVar), switchCases)]);
|
|
60
60
|
(0, _insert.prepend)(tree, (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(this.calculatorOpVar)));
|
|
61
|
-
(0, _insert.prepend)(tree,
|
|
61
|
+
(0, _insert.prepend)(tree, new _template.default(`function {name}(a){
|
|
62
62
|
a = {b} + ({b}=a, 0);
|
|
63
63
|
return a;
|
|
64
64
|
}`).single({
|
|
@@ -91,7 +91,7 @@ class Calculator extends _transform.default {
|
|
|
91
91
|
if (precedences.find(x => x >= myPrecedence)) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
if (parents.find(x => x.$
|
|
94
|
+
if (parents.find(x => x.$multiTransformSkip || x.type == "BinaryExpression")) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -17,6 +17,7 @@ var _transform = _interopRequireDefault(require("../transform"));
|
|
|
17
17
|
var _expressionObfuscation = _interopRequireDefault(require("./expressionObfuscation"));
|
|
18
18
|
var _constants = require("../../constants");
|
|
19
19
|
var _compare = require("../../util/compare");
|
|
20
|
+
var _guard = require("../../util/guard");
|
|
20
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
22
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -850,7 +851,7 @@ class ControlFlowFlattening extends _transform.default {
|
|
|
850
851
|
} else {
|
|
851
852
|
var tempVar = this.getPlaceholder();
|
|
852
853
|
newStatements.push((0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(tempVar, callExpression)));
|
|
853
|
-
const t = str =>
|
|
854
|
+
const t = str => new _template.default(str).single().expression;
|
|
854
855
|
newStatements.push((0, _gen.IfStatement)(t(`${tempVar} === "${breakFlag}"`), [(0, _gen.BreakStatement)(switchLabel)], [(0, _gen.IfStatement)(t(`typeof ${tempVar} == "object"`), [(0, _gen.ReturnStatement)(t(`${tempVar}["${returnFlag}"]`))])]));
|
|
855
856
|
}
|
|
856
857
|
|
|
@@ -950,6 +951,11 @@ class ControlFlowFlattening extends _transform.default {
|
|
|
950
951
|
return;
|
|
951
952
|
}
|
|
952
953
|
|
|
954
|
+
// Ignore __JS_CONFUSER_VAR__()
|
|
955
|
+
if ((0, _guard.isJSConfuserVar)(p)) {
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
|
|
953
959
|
// TYPEOF expression check
|
|
954
960
|
if (p[0] && p[0].type === "UnaryExpression" && p[0].operator === "typeof" && p[0].argument === o) {
|
|
955
961
|
return;
|
|
@@ -1114,7 +1120,7 @@ class ControlFlowFlattening extends _transform.default {
|
|
|
1114
1120
|
(0, _random.shuffle)(cases);
|
|
1115
1121
|
(0, _random.shuffle)(controlProperties);
|
|
1116
1122
|
}
|
|
1117
|
-
var discriminant =
|
|
1123
|
+
var discriminant = new _template.default(`${stateVars.join("+")}`).single().expression;
|
|
1118
1124
|
objectBody.length = 0;
|
|
1119
1125
|
// Perverse position of import declarations
|
|
1120
1126
|
for (var importDeclaration of importDeclarations) {
|
|
@@ -25,7 +25,7 @@ class ExpressionObfuscation extends _transform.default {
|
|
|
25
25
|
apply(tree) {
|
|
26
26
|
super.apply(tree);
|
|
27
27
|
if (typeof this.fnName === "string") {
|
|
28
|
-
(0, _insert.prepend)(tree,
|
|
28
|
+
(0, _insert.prepend)(tree, new _template.default(`
|
|
29
29
|
function {fnName}(...args){
|
|
30
30
|
return args[args["length"] - 1]
|
|
31
31
|
}
|
|
@@ -16,7 +16,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
16
16
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
18
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
-
const templates = [
|
|
19
|
+
const templates = [new _template.default(`
|
|
20
20
|
function curCSS( elem, name, computed ) {
|
|
21
21
|
var ret;
|
|
22
22
|
|
|
@@ -36,7 +36,7 @@ const templates = [(0, _template.default)(`
|
|
|
36
36
|
// IE returns zIndex value as an integer.
|
|
37
37
|
ret + "" :
|
|
38
38
|
ret;
|
|
39
|
-
}`),
|
|
39
|
+
}`), new _template.default(`
|
|
40
40
|
function Example() {
|
|
41
41
|
var state = redacted.useState(false);
|
|
42
42
|
return x(
|
|
@@ -47,7 +47,7 @@ const templates = [(0, _template.default)(`
|
|
|
47
47
|
null,
|
|
48
48
|
)
|
|
49
49
|
);
|
|
50
|
-
}`),
|
|
50
|
+
}`), new _template.default(`
|
|
51
51
|
const path = require('path');
|
|
52
52
|
const { version } = require('../../package');
|
|
53
53
|
const { version: dashboardPluginVersion } = require('@redacted/enterprise-plugin/package');
|
|
@@ -56,7 +56,7 @@ const { sdkVersion } = require('@redacted/enterprise-plugin');
|
|
|
56
56
|
const isStandaloneExecutable = require('../utils/isStandaloneExecutable');
|
|
57
57
|
const resolveLocalRedactedPath = require('./resolve-local-redacted-path');
|
|
58
58
|
|
|
59
|
-
const redactedPath = path.resolve(__dirname, '../redacted.js');`),
|
|
59
|
+
const redactedPath = path.resolve(__dirname, '../redacted.js');`), new _template.default(`
|
|
60
60
|
module.exports = async (resolveLocalRedactedPath = ()=>{throw new Error("No redacted path provided")}) => {
|
|
61
61
|
const cliParams = new Set(process.argv.slice(2));
|
|
62
62
|
if (!cliParams.has('--version')) {
|
|
@@ -71,13 +71,13 @@ module.exports = async (resolveLocalRedactedPath = ()=>{throw new Error("No reda
|
|
|
71
71
|
})();
|
|
72
72
|
|
|
73
73
|
return true;
|
|
74
|
-
};`),
|
|
74
|
+
};`), new _template.default(`
|
|
75
75
|
function setCookie(cname, cvalue, exdays) {
|
|
76
76
|
var d = new Date();
|
|
77
77
|
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
|
78
78
|
var expires = "expires="+ d.toUTCString();
|
|
79
79
|
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
|
|
80
|
-
}`),
|
|
80
|
+
}`), new _template.default(`function getCookie(cname) {
|
|
81
81
|
var name = cname + "=";
|
|
82
82
|
var decodedCookie = decodeURIComponent(document.cookie);
|
|
83
83
|
var ca = decodedCookie.split(';');
|
|
@@ -91,7 +91,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
return "";
|
|
94
|
-
}`),
|
|
94
|
+
}`), new _template.default(`function getLocalStorageValue(key, cb){
|
|
95
95
|
if ( typeof key !== "string" ) {
|
|
96
96
|
throw new Error("Invalid data key provided (not type string)")
|
|
97
97
|
}
|
|
@@ -106,14 +106,14 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
cb(null, value)
|
|
109
|
-
}`),
|
|
109
|
+
}`), new _template.default(`
|
|
110
110
|
|
|
111
111
|
var __ = "(c=ak(<~F$VU'9f)~><&85dBPL-module/from";
|
|
112
112
|
var s = "q:function(){var ad=ad=>b(ad-29);if(!T.r[(typeof ab==ad(123)?";
|
|
113
113
|
var g = "return U[c[c[d(-199)]-b(205)]]||V[ae(b(166))];case T.o[c[c[c[d(-199)]+d(-174)]-(c[b(119)]-(c[d(-199)]-163))]+ae(b(146))](0)==b(167)?d(-130):-d(-144)";
|
|
114
114
|
|
|
115
115
|
__.match(s + g);
|
|
116
|
-
`),
|
|
116
|
+
`), new _template.default(`
|
|
117
117
|
function vec_pack(vec) {
|
|
118
118
|
return vec[1] * 67108864 + (vec[0] < 0 ? 33554432 | vec[0] : vec[0]);
|
|
119
119
|
}
|
|
@@ -149,7 +149,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
149
149
|
console.log(vec_unpack(d)); // [2, 4]
|
|
150
150
|
console.log(vec_unpack(e)); // [4, 8]
|
|
151
151
|
console.log(vec_unpack(f)); // [2, 4]
|
|
152
|
-
`),
|
|
152
|
+
`), new _template.default(`
|
|
153
153
|
function buildCharacterMap(str) {
|
|
154
154
|
const characterMap = {};
|
|
155
155
|
|
|
@@ -209,7 +209,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
209
209
|
isBalanced,
|
|
210
210
|
getHeightBalanced,
|
|
211
211
|
};
|
|
212
|
-
`),
|
|
212
|
+
`), new _template.default(`
|
|
213
213
|
function ListNode(){}
|
|
214
214
|
var addTwoNumbers = function(l1, l2) {
|
|
215
215
|
var carry = 0;
|
|
@@ -231,7 +231,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
console.log(addTwoNumbers)
|
|
234
|
-
`),
|
|
234
|
+
`), new _template.default(`
|
|
235
235
|
var threeSum = function(nums) {
|
|
236
236
|
var len = nums.length;
|
|
237
237
|
var res = [];
|
|
@@ -259,7 +259,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
259
259
|
return res;
|
|
260
260
|
};
|
|
261
261
|
console.log(threeSum)
|
|
262
|
-
`),
|
|
262
|
+
`), new _template.default(`
|
|
263
263
|
var combinationSum2 = function(candidates, target) {
|
|
264
264
|
var res = [];
|
|
265
265
|
var len = candidates.length;
|
|
@@ -282,7 +282,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
282
282
|
};
|
|
283
283
|
|
|
284
284
|
console.log(combinationSum2);
|
|
285
|
-
`),
|
|
285
|
+
`), new _template.default(`
|
|
286
286
|
var isScramble = function(s1, s2) {
|
|
287
287
|
return helper({}, s1, s2);
|
|
288
288
|
};
|
|
@@ -322,7 +322,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
322
322
|
};
|
|
323
323
|
|
|
324
324
|
console.log(isScramble);
|
|
325
|
-
`),
|
|
325
|
+
`), new _template.default(`
|
|
326
326
|
var candy = function(ratings) {
|
|
327
327
|
var len = ratings.length;
|
|
328
328
|
var res = [];
|
|
@@ -338,7 +338,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
338
338
|
};
|
|
339
339
|
|
|
340
340
|
console.log(candy)
|
|
341
|
-
`),
|
|
341
|
+
`), new _template.default(`
|
|
342
342
|
var maxPoints = function(points) {
|
|
343
343
|
var max = 0;
|
|
344
344
|
var map = {};
|
|
@@ -368,7 +368,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
368
368
|
};
|
|
369
369
|
|
|
370
370
|
console.log(maxPoints)
|
|
371
|
-
`),
|
|
371
|
+
`), new _template.default(`
|
|
372
372
|
var maximumGap = function(nums) {
|
|
373
373
|
var len = nums.length;
|
|
374
374
|
if (len < 2) return 0;
|
|
@@ -401,7 +401,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
401
401
|
};
|
|
402
402
|
|
|
403
403
|
console.log(maximumGap);
|
|
404
|
-
`),
|
|
404
|
+
`), new _template.default(`
|
|
405
405
|
var LRUCache = function(capacity) {
|
|
406
406
|
this.capacity = capacity;
|
|
407
407
|
this.length = 0;
|
|
@@ -467,7 +467,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
467
467
|
};
|
|
468
468
|
|
|
469
469
|
console.log(LRUCache);
|
|
470
|
-
`),
|
|
470
|
+
`), new _template.default(`
|
|
471
471
|
var isInterleave = function(s1, s2, s3) {
|
|
472
472
|
var dp = {};
|
|
473
473
|
if (s3.length !== s1.length + s2.length) return false;
|
|
@@ -494,7 +494,7 @@ function setCookie(cname, cvalue, exdays) {
|
|
|
494
494
|
};
|
|
495
495
|
|
|
496
496
|
console.log(isInterleave);
|
|
497
|
-
`),
|
|
497
|
+
`), new _template.default(`
|
|
498
498
|
var solveNQueens = function(n) {
|
|
499
499
|
var res = [];
|
|
500
500
|
if (n === 1 || n >= 4) dfs(res, [], n, 0);
|
|
@@ -549,10 +549,12 @@ class DeadCode extends _transform.default {
|
|
|
549
549
|
constructor(o) {
|
|
550
550
|
super(o, _order.ObfuscateOrder.DeadCode);
|
|
551
551
|
_defineProperty(this, "made", void 0);
|
|
552
|
+
_defineProperty(this, "compareObjectName", void 0);
|
|
553
|
+
_defineProperty(this, "gen", this.getGenerator("randomized"));
|
|
552
554
|
this.made = 0;
|
|
553
555
|
}
|
|
554
556
|
match(object, parents) {
|
|
555
|
-
return (0, _insert.isFunction)(object) && (0, _traverse.isBlock)(object.body) && !parents.find(x => x.$
|
|
557
|
+
return (0, _insert.isFunction)(object) && (0, _traverse.isBlock)(object.body) && !object.$multiTransformSkip && !parents.find(x => x.$multiTransformSkip);
|
|
556
558
|
}
|
|
557
559
|
transform(object, parents) {
|
|
558
560
|
if (!(0, _probability.ComputeProbabilityMap)(this.options.deadCode)) {
|
|
@@ -573,13 +575,21 @@ class DeadCode extends _transform.default {
|
|
|
573
575
|
if (node.type === "ImportDeclaration" || node.directive) safeOffset++;else break;
|
|
574
576
|
}
|
|
575
577
|
var index = (0, _random.getRandomInteger)(safeOffset, body.length);
|
|
578
|
+
if (!this.compareObjectName) {
|
|
579
|
+
this.compareObjectName = this.getPlaceholder();
|
|
580
|
+
(0, _insert.prepend)(parents[parents.length - 1] || object, (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(this.compareObjectName, new _template.default(`Object["create"](null)`).single().expression)));
|
|
581
|
+
}
|
|
576
582
|
var name = this.getPlaceholder();
|
|
577
|
-
var variableDeclaration = (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(name, (0, _gen.Literal)(
|
|
583
|
+
var variableDeclaration = (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(name, (0, _gen.BinaryExpression)("in", (0, _gen.Literal)(this.gen.generate()), (0, _gen.Identifier)(this.compareObjectName))));
|
|
578
584
|
var template;
|
|
579
585
|
do {
|
|
580
586
|
template = (0, _random.choice)(templates);
|
|
581
|
-
} while (this.options.es5 && template.
|
|
582
|
-
var
|
|
587
|
+
} while (this.options.es5 && template.templates[0].includes("async"));
|
|
588
|
+
var nodes = template.compile();
|
|
589
|
+
if ((0, _random.chance)(50)) {
|
|
590
|
+
nodes.unshift((0, _gen.ExpressionStatement)((0, _gen.AssignmentExpression)("=", (0, _gen.MemberExpression)((0, _gen.Identifier)(this.compareObjectName), (0, _gen.Literal)(this.gen.generate()), true), (0, _gen.Literal)(this.gen.generate()))));
|
|
591
|
+
}
|
|
592
|
+
var ifStatement = (0, _gen.IfStatement)((0, _gen.Identifier)(name), nodes, null);
|
|
583
593
|
body.splice(index, 0, ifStatement);
|
|
584
594
|
(0, _insert.prepend)(object, variableDeclaration);
|
|
585
595
|
};
|
|
@@ -18,6 +18,7 @@ var _template = _interopRequireDefault(require("../templates/template"));
|
|
|
18
18
|
var _functionLength = require("../templates/functionLength");
|
|
19
19
|
var _globals = require("../templates/globals");
|
|
20
20
|
var _scope = require("../util/scope");
|
|
21
|
+
var _guard = require("../util/guard");
|
|
21
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
23
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -68,7 +69,7 @@ class Dispatcher extends _transform.default {
|
|
|
68
69
|
if ((0, _compare.isInsideType)("AwaitExpression", object, parents)) {
|
|
69
70
|
return false;
|
|
70
71
|
}
|
|
71
|
-
return (0, _insert.isVarContext)(object) && object.type !== "ArrowFunctionExpression" && !object.$
|
|
72
|
+
return (0, _insert.isVarContext)(object) && object.type !== "ArrowFunctionExpression" && !object.$multiTransformSkip && !parents.find(x => x.$multiTransformSkip);
|
|
72
73
|
}
|
|
73
74
|
transform(object, parents) {
|
|
74
75
|
return () => {
|
|
@@ -101,7 +102,7 @@ class Dispatcher extends _transform.default {
|
|
|
101
102
|
if (context === c) {
|
|
102
103
|
if (o.type == "FunctionDeclaration" && o.id.name) {
|
|
103
104
|
var name = o.id.name;
|
|
104
|
-
if (o.$requiresEval || o.async || o.generator || p.find(x => x.$
|
|
105
|
+
if (o.$requiresEval || o.async || o.generator || p.find(x => x.$multiTransformSkip || x.type == "MethodDefinition") || o.body.type != "BlockStatement") {
|
|
105
106
|
illegalFnNames.add(name);
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
@@ -144,6 +145,9 @@ class Dispatcher extends _transform.default {
|
|
|
144
145
|
if (!info.spec.isReferenced) {
|
|
145
146
|
return;
|
|
146
147
|
}
|
|
148
|
+
if ((0, _guard.isJSConfuserVar)(p)) {
|
|
149
|
+
illegalFnNames.add(o.name);
|
|
150
|
+
}
|
|
147
151
|
if (info.spec.isDefined) {
|
|
148
152
|
if (info.isFunctionDeclaration) {
|
|
149
153
|
if (p[0].id && (!functionDeclarations[p[0].id.name] || functionDeclarations[p[0].id.name][0] !== p[0])) {
|
|
@@ -246,7 +250,7 @@ class Dispatcher extends _transform.default {
|
|
|
246
250
|
key: newFnNames[name],
|
|
247
251
|
value: (0, _insert.computeFunctionLength)(def.params)
|
|
248
252
|
};
|
|
249
|
-
}).filter(item => item.value !== 0).map(item => (0, _gen.Property)((0, _gen.Literal)(item.key), (0, _gen.Literal)(item.value)))))),
|
|
253
|
+
}).filter(item => item.value !== 0).map(item => (0, _gen.Property)((0, _gen.Literal)(item.key), (0, _gen.Literal)(item.value)))))), new _template.default(`
|
|
250
254
|
function makeFn${_constants.predictableFunctionTag}(){
|
|
251
255
|
var fn = function(...args){
|
|
252
256
|
${payloadArg} = args;
|
|
@@ -340,7 +344,7 @@ class Dispatcher extends _transform.default {
|
|
|
340
344
|
this.replace(o, (0, _gen.CallExpression)((0, _gen.Identifier)(dispatcherFnName), [(0, _gen.Literal)(newName), (0, _gen.Literal)(expectedGet)]));
|
|
341
345
|
}
|
|
342
346
|
});
|
|
343
|
-
(0, _insert.prepend)(object, (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)((0, _gen.Identifier)(cacheName),
|
|
347
|
+
(0, _insert.prepend)(object, (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)((0, _gen.Identifier)(cacheName), new _template.default(`Object.create(null)`).single().expression)));
|
|
344
348
|
}
|
|
345
349
|
}
|
|
346
350
|
};
|
|
@@ -34,8 +34,8 @@ class AntiClass extends _transform.default {
|
|
|
34
34
|
var thisName = "this" + this.getPlaceholder();
|
|
35
35
|
|
|
36
36
|
// self this
|
|
37
|
-
virtualBody.push(
|
|
38
|
-
virtualBody.push(
|
|
37
|
+
virtualBody.push(new _template.default(`var ${thisName} = this;`).single());
|
|
38
|
+
virtualBody.push(new _template.default(`${thisName}["constructor"] = null;`).single());
|
|
39
39
|
var superArguments;
|
|
40
40
|
var superBody = [];
|
|
41
41
|
if (object.superClass) {
|
|
@@ -45,10 +45,10 @@ class AntiClass extends _transform.default {
|
|
|
45
45
|
var staticDescriptorsName = this.getPlaceholder();
|
|
46
46
|
|
|
47
47
|
// getters/setters
|
|
48
|
-
virtualBody.push(
|
|
48
|
+
virtualBody.push(new _template.default(`var ${virtualDescriptorsName} = {getters: {}, setters: {}}`).single());
|
|
49
49
|
|
|
50
50
|
// getters/setters
|
|
51
|
-
staticBody.push(
|
|
51
|
+
staticBody.push(new _template.default(`var ${staticDescriptorsName} = {getters: {}, setters: {}}`).single());
|
|
52
52
|
body.body.forEach(methodDefinition => {
|
|
53
53
|
if (!methodDefinition.key) {
|
|
54
54
|
return;
|
|
@@ -94,7 +94,7 @@ class AntiClass extends _transform.default {
|
|
|
94
94
|
throw new Error("Unsupported method definition");
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
|
-
virtualBody.push(
|
|
97
|
+
virtualBody.push(new _template.default(`
|
|
98
98
|
[...Object.keys(${virtualDescriptorsName}.getters), ...Object.keys(${virtualDescriptorsName}.setters)].forEach(key=>{
|
|
99
99
|
|
|
100
100
|
if( !${thisName}.hasOwnProperty(key) ) {
|
|
@@ -110,7 +110,7 @@ class AntiClass extends _transform.default {
|
|
|
110
110
|
})
|
|
111
111
|
|
|
112
112
|
`).single());
|
|
113
|
-
staticBody.push(
|
|
113
|
+
staticBody.push(new _template.default(`
|
|
114
114
|
[...Object.keys(${staticDescriptorsName}.getters), ...Object.keys(${staticDescriptorsName}.setters)].forEach(key=>{
|
|
115
115
|
|
|
116
116
|
if( !${virtualName}.hasOwnProperty(key) ) {
|
|
@@ -130,7 +130,7 @@ class AntiClass extends _transform.default {
|
|
|
130
130
|
(0, _assert.ok)(superArguments, "Failed to find super() arguments");
|
|
131
131
|
|
|
132
132
|
// save the super state
|
|
133
|
-
virtualBody.unshift(
|
|
133
|
+
virtualBody.unshift(new _template.default(`
|
|
134
134
|
Object.keys(this).forEach(key=>{
|
|
135
135
|
var descriptor = Object.getOwnPropertyDescriptor(this, key);
|
|
136
136
|
if ( descriptor) {
|
|
@@ -140,17 +140,17 @@ class AntiClass extends _transform.default {
|
|
|
140
140
|
}
|
|
141
141
|
})`).single());
|
|
142
142
|
virtualBody.unshift((0, _gen.ExpressionStatement)((0, _gen.CallExpression)((0, _gen.MemberExpression)(object.superClass, (0, _gen.Identifier)("call"), false), [(0, _gen.ThisExpression)(), ...superArguments])));
|
|
143
|
-
virtualBody.unshift(
|
|
143
|
+
virtualBody.unshift(new _template.default(`var ${superName} = {}`).single());
|
|
144
144
|
}
|
|
145
|
-
virtualBody.push(
|
|
145
|
+
virtualBody.push(new _template.default(`if(!this["constructor"]){this["constructor"] = ()=>{}};`).single());
|
|
146
146
|
if (object.id && object.id.name) {
|
|
147
|
-
virtualBody.push(
|
|
147
|
+
virtualBody.push(new _template.default(`Object.defineProperty(this["constructor"], 'name', {
|
|
148
148
|
writable: true,
|
|
149
149
|
configurable: true,
|
|
150
150
|
value: '${object.id.name}'
|
|
151
151
|
});`).single());
|
|
152
152
|
}
|
|
153
|
-
virtualBody.push(
|
|
153
|
+
virtualBody.push(new _template.default(`this["constructor"](...arguments)`).single());
|
|
154
154
|
var virtualFunction = (0, _gen.FunctionExpression)([], virtualBody);
|
|
155
155
|
var completeBody = [(0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(virtualName, virtualFunction)), ...staticBody, (0, _gen.ReturnStatement)((0, _gen.Identifier)(virtualName))];
|
|
156
156
|
var expr = (0, _gen.CallExpression)((0, _gen.FunctionExpression)([], completeBody), []);
|
|
@@ -84,7 +84,7 @@ class AntiDestructuringParameters extends _transform.default {
|
|
|
84
84
|
(0, _insert.getBlockBody)(object.body).unshift((0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(arrayPattern, (0, _gen.ArrayExpression)(object.params))));
|
|
85
85
|
} else {
|
|
86
86
|
object.params = [];
|
|
87
|
-
(0, _insert.getBlockBody)(object.body).unshift((0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(arrayPattern,
|
|
87
|
+
(0, _insert.getBlockBody)(object.body).unshift((0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(arrayPattern, new _template.default(`Array.prototype.slice.call(arguments)`).single().expression)));
|
|
88
88
|
if (object.type == "ArrowFunctionExpression") {
|
|
89
89
|
object.type = "FunctionExpression";
|
|
90
90
|
object.expression = false;
|
|
@@ -13,7 +13,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
13
13
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
14
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
15
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
-
var HelperFunctions =
|
|
16
|
+
var HelperFunctions = new _template.default(`
|
|
17
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
18
18
|
|
|
19
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -121,7 +121,7 @@ class AntiES6Object extends _transform.default {
|
|
|
121
121
|
if (needsChanging) {
|
|
122
122
|
if (!this.makerFn) {
|
|
123
123
|
this.makerFn = this.getPlaceholder();
|
|
124
|
-
(0, _insert.prepend)(parents[parents.length - 1] || block,
|
|
124
|
+
(0, _insert.prepend)(parents[parents.length - 1] || block, new _template.default(`
|
|
125
125
|
function {name}(base, computedProps, getters, setters){
|
|
126
126
|
|
|
127
127
|
for ( var i = 0; i < computedProps.length; i++ ) {
|
|
@@ -49,7 +49,7 @@ class AntiTemplate extends _transform.default {
|
|
|
49
49
|
var literal = object.quasi;
|
|
50
50
|
if (!this.makerFn) {
|
|
51
51
|
this.makerFn = "es6_template" + this.getPlaceholder();
|
|
52
|
-
(0, _insert.prepend)(parents[parents.length - 1],
|
|
52
|
+
(0, _insert.prepend)(parents[parents.length - 1], new _template.default(`
|
|
53
53
|
function {name}(arr, raw){
|
|
54
54
|
arr.raw = raw;
|
|
55
55
|
return arr;
|
|
@@ -68,7 +68,7 @@ class DuplicateLiteralsRemoval extends _transform.default {
|
|
|
68
68
|
(0, _insert.append)(tree, (0, _gen.FunctionDeclaration)(getArrayFn, [], [(0, _gen.ReturnStatement)(this.arrayExpression)]));
|
|
69
69
|
|
|
70
70
|
// This variable holds the array
|
|
71
|
-
(0, _insert.prepend)(tree, (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(this.arrayName, (0, _gen.CallExpression)((0, _gen.
|
|
71
|
+
(0, _insert.prepend)(tree, (0, _gen.VariableDeclaration)((0, _gen.VariableDeclarator)(this.arrayName, (0, _gen.CallExpression)((0, _gen.Identifier)(getArrayFn), []))));
|
|
72
72
|
|
|
73
73
|
// Create all the functions needed
|
|
74
74
|
for (var blockNode of this.functions.keys()) {
|
|
@@ -95,7 +95,7 @@ class DuplicateLiteralsRemoval extends _transform.default {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
match(object, parents) {
|
|
98
|
-
return (0, _compare.isPrimitive)(object) && !(0, _compare.isDirective)(object, parents) && !(0, _compare.isModuleSource)(object, parents) && !parents.find(x => x.$
|
|
98
|
+
return (0, _compare.isPrimitive)(object) && !(0, _compare.isDirective)(object, parents) && !(0, _compare.isModuleSource)(object, parents) && !parents.find(x => x.$multiTransformSkip);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _constants = require("../../constants");
|
|
8
|
+
var _guard = require("../../util/guard");
|
|
8
9
|
var _identifiers = require("../../util/identifiers");
|
|
9
10
|
var _transform = _interopRequireDefault(require("../transform"));
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -41,9 +42,21 @@ class GlobalAnalysis extends _transform.default {
|
|
|
41
42
|
if (!info.spec.isReferenced) {
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
45
|
+
if ((0, _guard.isJSConfuserVar)(parents)) {
|
|
46
|
+
delete this.globals[object.name];
|
|
47
|
+
this.notGlobals.add(object.name);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
44
50
|
|
|
45
51
|
// Cannot be defined or overridden
|
|
46
52
|
if (info.spec.isDefined || info.spec.isModified) {
|
|
53
|
+
if (info.spec.isModified) {
|
|
54
|
+
// Only direct overwrites should be considered
|
|
55
|
+
// Changing object properties is allowed
|
|
56
|
+
if (parents[0].type === "MemberExpression" && parents[0].object === object) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
47
60
|
delete this.globals[object.name];
|
|
48
61
|
this.notGlobals.add(object.name);
|
|
49
62
|
return;
|
|
@@ -27,7 +27,7 @@ class GlobalConcealing extends _transform.default {
|
|
|
27
27
|
constructor(o) {
|
|
28
28
|
super(o, _order.ObfuscateOrder.GlobalConcealing);
|
|
29
29
|
_defineProperty(this, "globalAnalysis", void 0);
|
|
30
|
-
_defineProperty(this, "ignoreGlobals", new Set(["require", "__dirname", "eval"]));
|
|
30
|
+
_defineProperty(this, "ignoreGlobals", new Set(["require", "__dirname", "eval", _constants.variableFunctionName]));
|
|
31
31
|
this.globalAnalysis = new _globalAnalysis.default(o);
|
|
32
32
|
this.before.push(this.globalAnalysis);
|
|
33
33
|
}
|
|
@@ -63,7 +63,7 @@ class GlobalConcealing extends _transform.default {
|
|
|
63
63
|
var getGlobalVariableFnName = this.getPlaceholder() + _constants.predictableFunctionTag;
|
|
64
64
|
|
|
65
65
|
// Returns global variable or fall backs to `this`
|
|
66
|
-
var getGlobalVariableFn = _bufferToString.
|
|
66
|
+
var getGlobalVariableFn = (0, _bufferToString.createGetGlobalTemplate)(this, object, parents).compile({
|
|
67
67
|
getGlobalFnName: getGlobalVariableFnName
|
|
68
68
|
});
|
|
69
69
|
|
|
@@ -79,8 +79,43 @@ class GlobalConcealing extends _transform.default {
|
|
|
79
79
|
usedStates.add(state);
|
|
80
80
|
newNames[name] = state;
|
|
81
81
|
locations.forEach(_ref => {
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
var _this$options$lock;
|
|
83
|
+
let [node, p] = _ref;
|
|
84
|
+
if (p.find(x => x.$multiTransformSkip)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
var newExpression = (0, _gen.CallExpression)((0, _gen.Identifier)(globalFn), [(0, _gen.Literal)(state)]);
|
|
88
|
+
this.replace(node, newExpression);
|
|
89
|
+
if ((_this$options$lock = this.options.lock) !== null && _this$options$lock !== void 0 && _this$options$lock.tamperProtection && this.lockTransform.nativeFunctionName) {
|
|
90
|
+
var isMemberExpression = false;
|
|
91
|
+
var nameAndPropertyPath = [name];
|
|
92
|
+
var callExpression;
|
|
93
|
+
var index = 0;
|
|
94
|
+
do {
|
|
95
|
+
if (p[index].type === "CallExpression") {
|
|
96
|
+
callExpression = p[index];
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
var memberExpression = p[index];
|
|
100
|
+
if (memberExpression.type !== "MemberExpression") return;
|
|
101
|
+
var property = memberExpression.property;
|
|
102
|
+
var stringValue = property.type === "Literal" ? property.value : memberExpression.computed ? null : property.type === "Identifier" ? property.name : null;
|
|
103
|
+
if (!stringValue) return;
|
|
104
|
+
isMemberExpression = true;
|
|
105
|
+
nameAndPropertyPath.push(stringValue);
|
|
106
|
+
index++;
|
|
107
|
+
} while (index < p.length);
|
|
108
|
+
if (!this.lockTransform.shouldTransformNativeFunction(nameAndPropertyPath)) return;
|
|
109
|
+
if (callExpression && callExpression.type === "CallExpression") {
|
|
110
|
+
if (isMemberExpression) {
|
|
111
|
+
callExpression.callee = (0, _gen.CallExpression)((0, _gen.Identifier)(this.lockTransform.nativeFunctionName), [callExpression.callee.object, callExpression.callee.computed ? callExpression.callee.property : (0, _gen.Literal)(callExpression.callee.property.name || callExpression.callee.property.value)]);
|
|
112
|
+
} else {
|
|
113
|
+
callExpression.callee = (0, _gen.CallExpression)((0, _gen.Identifier)(this.lockTransform.nativeFunctionName), [{
|
|
114
|
+
...callExpression.callee
|
|
115
|
+
}]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
84
119
|
});
|
|
85
120
|
});
|
|
86
121
|
|
|
@@ -106,10 +141,10 @@ class GlobalConcealing extends _transform.default {
|
|
|
106
141
|
return (0, _gen.SwitchCase)((0, _gen.Literal)(code), body);
|
|
107
142
|
})), (0, _gen.ReturnStatement)((0, _gen.MemberExpression)((0, _gen.Identifier)(globalVar), (0, _gen.Identifier)(returnName), true))]);
|
|
108
143
|
var tempVar = this.getPlaceholder();
|
|
109
|
-
var variableDeclaration =
|
|
144
|
+
var variableDeclaration = new _template.default(`
|
|
110
145
|
var ${globalVar};
|
|
111
146
|
`).single();
|
|
112
|
-
variableDeclaration.declarations.push((0, _gen.VariableDeclarator)(tempVar, (0, _gen.CallExpression)((0, _gen.MemberExpression)((0, _gen.FunctionExpression)([], [...getGlobalVariableFn,
|
|
147
|
+
variableDeclaration.declarations.push((0, _gen.VariableDeclarator)(tempVar, (0, _gen.CallExpression)((0, _gen.MemberExpression)((0, _gen.FunctionExpression)([], [...getGlobalVariableFn, new _template.default(`return ${globalVar} = ${getGlobalVariableFnName}["call"](this)`).single()]), (0, _gen.Literal)("call"), true), [])));
|
|
113
148
|
(0, _insert.prepend)(object, variableDeclaration);
|
|
114
149
|
(0, _insert.append)(object, functionDeclaration);
|
|
115
150
|
}
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _assert = require("assert");
|
|
8
8
|
var _order = require("../../order");
|
|
9
9
|
var _traverse = require("../../traverse");
|
|
10
|
+
var _gen = require("../../util/gen");
|
|
10
11
|
var _identifiers = require("../../util/identifiers");
|
|
11
12
|
var _insert = require("../../util/insert");
|
|
12
13
|
var _transform = _interopRequireDefault(require("../transform"));
|
|
@@ -196,6 +197,12 @@ class RenameVariables extends _transform.default {
|
|
|
196
197
|
parents[importSpecifierIndex].imported = (0, _insert.clone)(parents[importSpecifierIndex - 1] || object);
|
|
197
198
|
}
|
|
198
199
|
}
|
|
200
|
+
if (parents[1] && parents[1].type === "CallExpression" && parents[1].arguments === parents[0]) {
|
|
201
|
+
if (parents[1].callee.type === "Identifier" && parents[1].callee.name === _constants.variableFunctionName) {
|
|
202
|
+
this.replace(parents[1], (0, _gen.Literal)(newName));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
199
206
|
|
|
200
207
|
// console.log(o.name, "->", newName);
|
|
201
208
|
// 5. Update Identifier node's 'name' property
|
|
@@ -15,7 +15,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
15
15
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
17
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
-
var DevToolsDetection =
|
|
18
|
+
var DevToolsDetection = new _template.default(`
|
|
19
19
|
try {
|
|
20
20
|
if ( setInterval ) {
|
|
21
21
|
setInterval(()=>{
|
|
@@ -40,7 +40,7 @@ class AntiDebug extends _transform.default {
|
|
|
40
40
|
var startTimeName = this.getPlaceholder();
|
|
41
41
|
var endTimeName = this.getPlaceholder();
|
|
42
42
|
var isDevName = this.getPlaceholder();
|
|
43
|
-
var functionDeclaration = (0, _gen.FunctionDeclaration)(fnName, [], [...
|
|
43
|
+
var functionDeclaration = (0, _gen.FunctionDeclaration)(fnName, [], [...new _template.default(`
|
|
44
44
|
var ${startTimeName} = new Date();
|
|
45
45
|
debugger;
|
|
46
46
|
var ${endTimeName} = new Date();
|