js-confuser 2.0.0-alpha.3 → 2.0.0-alpha.5
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/.prettierrc +4 -0
- package/CHANGELOG.md +18 -2
- package/Migration.md +23 -8
- package/README.md +2 -2
- package/dist/constants.js +7 -4
- package/dist/index.js +43 -7
- package/dist/obfuscator.js +5 -5
- package/dist/templates/integrityTemplate.js +1 -1
- package/dist/transforms/controlFlowFlattening.js +158 -108
- package/dist/transforms/deadCode.js +13 -7
- package/dist/transforms/dispatcher.js +61 -35
- package/dist/transforms/identifier/globalConcealing.js +2 -2
- package/dist/transforms/identifier/renameVariables.js +33 -0
- package/dist/transforms/lock/integrity.js +9 -1
- package/dist/transforms/lock/lock.js +7 -7
- package/dist/transforms/minify.js +50 -26
- package/dist/transforms/opaquePredicates.js +1 -1
- package/dist/transforms/pack.js +27 -5
- package/dist/transforms/plugin.js +12 -3
- package/dist/transforms/preparation.js +25 -36
- package/dist/transforms/rgf.js +7 -5
- package/dist/transforms/string/stringConcealing.js +3 -1
- package/dist/transforms/variableMasking.js +2 -0
- package/dist/utils/NameGen.js +2 -0
- package/dist/utils/ast-utils.js +15 -33
- package/dist/utils/random-utils.js +10 -0
- package/index.d.ts +16 -2
- package/package.json +1 -1
- package/src/constants.ts +11 -2
- package/src/index.ts +21 -7
- package/src/obfuscationResult.ts +7 -1
- package/src/obfuscator.ts +5 -6
- package/src/options.ts +12 -2
- package/src/templates/integrityTemplate.ts +15 -20
- package/src/transforms/controlFlowFlattening.ts +201 -126
- package/src/transforms/deadCode.ts +16 -7
- package/src/transforms/dispatcher.ts +23 -3
- package/src/transforms/identifier/globalConcealing.ts +22 -15
- package/src/transforms/identifier/renameVariables.ts +38 -0
- package/src/transforms/lock/integrity.ts +11 -1
- package/src/transforms/lock/lock.ts +12 -7
- package/src/transforms/minify.ts +61 -36
- package/src/transforms/opaquePredicates.ts +1 -1
- package/src/transforms/pack.ts +35 -5
- package/src/transforms/plugin.ts +19 -9
- package/src/transforms/preparation.ts +33 -46
- package/src/transforms/rgf.ts +13 -9
- package/src/transforms/string/stringConcealing.ts +2 -0
- package/src/transforms/variableMasking.ts +1 -0
- package/src/utils/NameGen.ts +9 -1
- package/src/utils/ast-utils.ts +10 -21
- package/src/utils/random-utils.ts +14 -0
- package/src/probability.ts +0 -0
package/.prettierrc
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -69,9 +69,25 @@ const options = {
|
|
|
69
69
|
|
|
70
70
|
- - `String Compression` now uses LZ-string compression ([lz-string](https://www.npmjs.com/package/lz-string))
|
|
71
71
|
|
|
72
|
+
- New Comment Syntax
|
|
73
|
+
|
|
74
|
+
- - `/* @js-confuser-var */ "name"` for improved variable mappings for eval() calls
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
// Input
|
|
78
|
+
var name = "Internet User";
|
|
79
|
+
eval( "console.log(" + /* @js-confuser-var */ "name" + ")" );
|
|
80
|
+
|
|
81
|
+
// Output
|
|
82
|
+
var zC3PLKu = "Internet User";
|
|
83
|
+
eval("console.log(" + "zC3PLKu" + ")");
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The function `__JS_CONFUSER_VAR__` is identical in outcome and still be used, however, the comment syntax is preferred as the comment syntax's preserves the original script's behavior.
|
|
87
|
+
|
|
72
88
|
### JS-Confuser.com Revamp
|
|
73
89
|
|
|
74
|
-
A new UI for JS-Confuser.com, featuring an advanced playground and documentation pages.
|
|
90
|
+
A new UI for [JS-Confuser.com](https://js-confuser.com), featuring an advanced playground and documentation pages.
|
|
75
91
|
|
|
76
92
|
The previous version will remain available: [old--confuser.netlify.com](https://old--confuser.netlify.app/)
|
|
77
93
|
|
|
@@ -83,7 +99,7 @@ The previous version will remain available: [old--confuser.netlify.com](https://
|
|
|
83
99
|
|
|
84
100
|
- Removed `Shuffle`'s Hash option
|
|
85
101
|
|
|
86
|
-
- Removed `Indent` option
|
|
102
|
+
- Removed `Indent` option
|
|
87
103
|
|
|
88
104
|
|
|
89
105
|
# `1.7.3`
|
package/Migration.md
CHANGED
|
@@ -6,15 +6,20 @@ JS-Confuser 2.0 is complete rewrite of the original JS-Confuser created in 2020!
|
|
|
6
6
|
|
|
7
7
|
### JSConfuser.obfuscate() returns an object now
|
|
8
8
|
|
|
9
|
-
The method `JSConfuser.obfuscate()` resolves to a object now instead of a string. This result object contains
|
|
9
|
+
The method `JSConfuser.obfuscate()` resolves to a object now instead of a string. This result object contains a property `code` which is the obfuscated code.
|
|
10
10
|
|
|
11
11
|
```diff
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const sourceCode = `console.log("Hello World")`;
|
|
13
|
+
const options = {
|
|
14
|
+
target: "node",
|
|
15
|
+
preset: "high"
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
JSConfuser.obfuscate(sourceCode, options).then(result=>{
|
|
19
|
+
// 'result' is now an object
|
|
20
|
+
- console.log(result);
|
|
21
|
+
+ console.log(result.code);
|
|
22
|
+
});
|
|
18
23
|
```
|
|
19
24
|
|
|
20
25
|
### Removed Anti Debug Lock / Browser Lock / OS Lock
|
|
@@ -54,4 +59,14 @@ These features have been removed but you can still add these locks using the `lo
|
|
|
54
59
|
|
|
55
60
|
The option `stack` has been renamed to `variableMasking`
|
|
56
61
|
|
|
57
|
-
[Similar to JScrambler's Variable Masking](https://docs.jscrambler.com/code-integrity/documentation/transformations/variable-masking)
|
|
62
|
+
[Similar to JScrambler's Variable Masking](https://docs.jscrambler.com/code-integrity/documentation/transformations/variable-masking)
|
|
63
|
+
|
|
64
|
+
```diff
|
|
65
|
+
const options = {
|
|
66
|
+
target: "node",
|
|
67
|
+
preset: "high"
|
|
68
|
+
|
|
69
|
+
- stack: true,
|
|
70
|
+
+ variableMasking: true
|
|
71
|
+
};
|
|
72
|
+
```
|
package/README.md
CHANGED
|
@@ -21,9 +21,9 @@ JS-Confuser is a JavaScript obfuscation tool to make your programs _impossible_
|
|
|
21
21
|
|
|
22
22
|
- - [FAQ](https://new--confuser.netlify.app/docs/getting-started/faq)
|
|
23
23
|
|
|
24
|
-
- [Options](https://new--confuser.netlify.app/docs)
|
|
24
|
+
- [Options](https://new--confuser.netlify.app/docs/options)
|
|
25
25
|
|
|
26
|
-
- [Presets](https://new--confuser.netlify.app/docs)
|
|
26
|
+
- [Presets](https://new--confuser.netlify.app/docs/presets)
|
|
27
27
|
|
|
28
28
|
## API Usage
|
|
29
29
|
|
package/dist/constants.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.variableFunctionName = exports.reservedObjectPrototype = exports.
|
|
7
|
-
var predictableFunctionTag = exports.predictableFunctionTag = "__JS_PREDICT__";
|
|
8
|
-
|
|
6
|
+
exports.variableFunctionName = exports.reservedObjectPrototype = exports.reservedNodeModuleIdentifiers = exports.reservedKeywords = exports.reservedIdentifiers = exports.placeholderVariablePrefix = exports.noRenameVariablePrefix = exports.WITH_STATEMENT = exports.UNSAFE = exports.SKIP = exports.PREDICTABLE = exports.NO_RENAME = exports.NO_REMOVE = exports.MULTI_TRANSFORM = exports.GEN_NODE = exports.FN_LENGTH = void 0;
|
|
9
7
|
/**
|
|
10
8
|
* A function is 'unsafe' if it requires 'eval', 'arguments' or 'this'
|
|
11
9
|
*
|
|
@@ -79,11 +77,16 @@ var placeholderVariablePrefix = exports.placeholderVariablePrefix = "__p_";
|
|
|
79
77
|
* Identifiers that are not actually variables.
|
|
80
78
|
*/
|
|
81
79
|
var reservedIdentifiers = exports.reservedIdentifiers = new Set(["undefined", "null", "NaN", "Infinity", "eval", "arguments"]);
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Reserved Node.JS module identifiers.
|
|
83
|
+
*/
|
|
84
|
+
var reservedNodeModuleIdentifiers = exports.reservedNodeModuleIdentifiers = new Set(["module", "exports", "require"]);
|
|
82
85
|
var reservedObjectPrototype = exports.reservedObjectPrototype = new Set(["toString", "valueOf", "constructor", "__proto__", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString"]);
|
|
83
86
|
|
|
84
87
|
/**
|
|
85
88
|
* For Zero Width generator - Mangled variable names
|
|
86
89
|
*/
|
|
87
|
-
var reservedKeywords = exports.reservedKeywords = ["if", "in", "for", "let", "new", "try", "var", "case", "else", "null", "break", "catch", "class", "const", "super", "throw", "while", "yield", "delete", "export", "import", "public", "return", "switch", "default", "finally", "private", "continue", "debugger", "function", "arguments", "protected", "instanceof", "await", "async",
|
|
90
|
+
var reservedKeywords = exports.reservedKeywords = ["if", "in", "do", "for", "let", "new", "try", "var", "case", "else", "null", "with", "break", "catch", "class", "const", "super", "throw", "while", "yield", "delete", "export", "import", "public", "return", "switch", "default", "finally", "private", "continue", "debugger", "function", "arguments", "protected", "instanceof", "await", "async",
|
|
88
91
|
// new key words and other fun stuff :P
|
|
89
92
|
"NaN", "undefined", "true", "false", "typeof", "this", "static", "void", "of"];
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "Obfuscator", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _obfuscator["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "Template", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
@@ -65,15 +71,37 @@ function _obfuscateAST() {
|
|
|
65
71
|
}));
|
|
66
72
|
return _obfuscateAST.apply(this, arguments);
|
|
67
73
|
}
|
|
68
|
-
function obfuscateWithProfiler(_x5, _x6
|
|
74
|
+
function obfuscateWithProfiler(_x5, _x6) {
|
|
69
75
|
return _obfuscateWithProfiler.apply(this, arguments);
|
|
70
76
|
}
|
|
71
77
|
function _obfuscateWithProfiler() {
|
|
72
|
-
_obfuscateWithProfiler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourceCode, options
|
|
73
|
-
var
|
|
78
|
+
_obfuscateWithProfiler = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sourceCode, options) {
|
|
79
|
+
var _profiler,
|
|
80
|
+
startTime,
|
|
81
|
+
obfuscator,
|
|
82
|
+
totalTransforms,
|
|
83
|
+
transformMap,
|
|
84
|
+
beforeParseTime,
|
|
85
|
+
ast,
|
|
86
|
+
parseTime,
|
|
87
|
+
currentTransformTime,
|
|
88
|
+
beforeCompileTime,
|
|
89
|
+
code,
|
|
90
|
+
compileTime,
|
|
91
|
+
endTime,
|
|
92
|
+
obfuscationTime,
|
|
93
|
+
_args3 = arguments;
|
|
74
94
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
75
95
|
while (1) switch (_context3.prev = _context3.next) {
|
|
76
96
|
case 0:
|
|
97
|
+
_profiler = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
|
|
98
|
+
if (!_profiler.performance) {
|
|
99
|
+
_profiler.performance = {
|
|
100
|
+
now: function now() {
|
|
101
|
+
return Date.now();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
77
105
|
startTime = performance.now();
|
|
78
106
|
obfuscator = new _obfuscator["default"](options);
|
|
79
107
|
totalTransforms = obfuscator.plugins.length;
|
|
@@ -84,13 +112,20 @@ function _obfuscateWithProfiler() {
|
|
|
84
112
|
currentTransformTime = performance.now();
|
|
85
113
|
ast = obfuscator.obfuscateAST(ast, {
|
|
86
114
|
profiler: function profiler(log) {
|
|
115
|
+
var _profiler$callback;
|
|
87
116
|
var nowTime = performance.now();
|
|
88
|
-
|
|
117
|
+
var entry = {
|
|
89
118
|
transformTime: nowTime - currentTransformTime,
|
|
90
119
|
changeData: {}
|
|
91
120
|
};
|
|
92
|
-
|
|
93
|
-
|
|
121
|
+
transformMap[log.currentTransform] = entry;
|
|
122
|
+
|
|
123
|
+
// (JS-Confuser.com can run performance benchmark tests here)
|
|
124
|
+
(_profiler$callback = _profiler.callback) === null || _profiler$callback === void 0 || _profiler$callback.call(_profiler, log, entry, ast);
|
|
125
|
+
|
|
126
|
+
// The profiler.callback() function may take a long time to execute,
|
|
127
|
+
// so we need to update the currentTransformTime here for accurate profiling.
|
|
128
|
+
currentTransformTime = performance.now();
|
|
94
129
|
}
|
|
95
130
|
});
|
|
96
131
|
obfuscator.plugins.forEach(function (_ref) {
|
|
@@ -115,7 +150,7 @@ function _obfuscateWithProfiler() {
|
|
|
115
150
|
totalPossibleTransforms: obfuscator.totalPossibleTransforms
|
|
116
151
|
}
|
|
117
152
|
});
|
|
118
|
-
case
|
|
153
|
+
case 18:
|
|
119
154
|
case "end":
|
|
120
155
|
return _context3.stop();
|
|
121
156
|
}
|
|
@@ -127,6 +162,7 @@ var JsConfuser = {
|
|
|
127
162
|
obfuscate: obfuscate,
|
|
128
163
|
obfuscateAST: obfuscateAST,
|
|
129
164
|
obfuscateWithProfiler: obfuscateWithProfiler,
|
|
165
|
+
Obfuscator: _obfuscator["default"],
|
|
130
166
|
presets: _presets["default"],
|
|
131
167
|
Template: _template["default"]
|
|
132
168
|
};
|
package/dist/obfuscator.js
CHANGED
|
@@ -12,6 +12,7 @@ var _validateOptions = require("./validateOptions");
|
|
|
12
12
|
var _NameGen = require("./utils/NameGen");
|
|
13
13
|
var _order = require("./order");
|
|
14
14
|
var _plugin = require("./transforms/plugin");
|
|
15
|
+
var _objectUtils = require("./utils/object-utils");
|
|
15
16
|
var _preparation = _interopRequireDefault(require("./transforms/preparation"));
|
|
16
17
|
var _renameVariables = _interopRequireDefault(require("./transforms/identifier/renameVariables"));
|
|
17
18
|
var _variableMasking = _interopRequireDefault(require("./transforms/variableMasking"));
|
|
@@ -37,7 +38,6 @@ var _minify = _interopRequireDefault(require("./transforms/minify"));
|
|
|
37
38
|
var _finalizer = _interopRequireDefault(require("./transforms/finalizer"));
|
|
38
39
|
var _integrity = _interopRequireDefault(require("./transforms/lock/integrity"));
|
|
39
40
|
var _pack = _interopRequireDefault(require("./transforms/pack"));
|
|
40
|
-
var _objectUtils = require("./utils/object-utils");
|
|
41
41
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
42
42
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
43
43
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
@@ -165,7 +165,10 @@ var Obfuscator = exports["default"] = /*#__PURE__*/function () {
|
|
|
165
165
|
}
|
|
166
166
|
return _createClass(Obfuscator, [{
|
|
167
167
|
key: "isInternalVariable",
|
|
168
|
-
value:
|
|
168
|
+
value:
|
|
169
|
+
// Pack Interface for sharing globals across RGF functions
|
|
170
|
+
|
|
171
|
+
function isInternalVariable(name) {
|
|
169
172
|
return Object.values(this.globalState.internals).includes(name);
|
|
170
173
|
}
|
|
171
174
|
}, {
|
|
@@ -233,9 +236,6 @@ var Obfuscator = exports["default"] = /*#__PURE__*/function () {
|
|
|
233
236
|
var _this$plugins$i = this.plugins[i],
|
|
234
237
|
plugin = _this$plugins$i.plugin,
|
|
235
238
|
pluginInstance = _this$plugins$i.pluginInstance;
|
|
236
|
-
|
|
237
|
-
// Skip pack if disabled
|
|
238
|
-
if (pluginInstance.order === _order.Order.Pack && options !== null && options !== void 0 && options.disablePack) continue;
|
|
239
239
|
if (this.options.verbose) {
|
|
240
240
|
console.log("Applying ".concat(pluginInstance.name, " (").concat(i + 1, "/").concat(this.plugins.length, ")"));
|
|
241
241
|
}
|
|
@@ -27,4 +27,4 @@ function HashFunction(str, seed) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// In template form to be inserted into code
|
|
30
|
-
var HashTemplate = exports.HashTemplate = new _template["default"]("\n// Must be Function Declaration for hoisting\n// Math.imul polyfill for ES5\nfunction
|
|
30
|
+
var HashTemplate = exports.HashTemplate = new _template["default"]("\n// Must be Function Declaration for hoisting\n// Math.imul polyfill for ES5\nfunction MathImulPolyfill(opA, opB){\n opB |= 0; // ensure that opB is an integer. opA will automatically be coerced.\n // floating points give us 53 bits of precision to work with plus 1 sign bit\n // automatically handled for our convienence:\n // 1. 0x003fffff /*opA & 0x000fffff*/ * 0x7fffffff /*opB*/ = 0x1fffff7fc00001\n // 0x1fffff7fc00001 < Number.MAX_SAFE_INTEGER /*0x1fffffffffffff*/\n var result = (opA & 0x003fffff) * opB;\n // 2. We can remove an integer coersion from the statement above because:\n // 0x1fffff7fc00001 + 0xffc00000 = 0x1fffffff800001\n // 0x1fffffff800001 < Number.MAX_SAFE_INTEGER /*0x1fffffffffffff*/\n if (opA & 0xffc00000 /*!== 0*/) result += (opA & 0xffc00000) * opB |0;\n return result |0;\n};\n\nvar {imul} = Math[\"imul\"] || MathImulPolyfill;\n\nfunction {hashingUtilFnName}(str, seed) {\n var h1 = 0xdeadbeef ^ seed;\n var h2 = 0x41c6ce57 ^ seed;\n for (var i = 0, ch; i < str.length; i++) {\n ch = str.charCodeAt(i);\n h1 = {imul}(h1 ^ ch, 2654435761);\n h2 = {imul}(h2 ^ ch, 1597334677);\n }\n h1 = {imul}(h1 ^ (h1>>>16), 2246822507) ^ {imul}(h2 ^ (h2>>>13), 3266489909);\n h2 = {imul}(h2 ^ (h2>>>16), 2246822507) ^ {imul}(h1 ^ (h1>>>13), 3266489909);\n return 4294967296 * (2097151 & h2) + (h1>>>0);\n};\n\n// Simple function that returns .toString() value with spaces replaced out\nfunction {name}(fnObject, seed, regex={sensitivityRegex}){\n var fnStringed = fnObject[\"toString\"]()[\"replace\"](regex, \"\");\n return {hashingUtilFnName}(fnStringed, seed);\n}\n").addSymbols(_constants.SKIP, _constants.MULTI_TRANSFORM);
|