js-confuser 1.4.1 → 1.4.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # `1.4.2`
2
+ Eval Fix
3
+
4
+ - Fixed [#31](https://github.com/MichaelXF/js-confuser/issues/31)
5
+ - - Eval and Integrity didn't work together, fixed in this version.
6
+
1
7
  # `1.4.1`
2
8
  AntiDebug Fix
3
9
 
@@ -27,7 +27,7 @@ class Eval extends _transform.default {
27
27
  }
28
28
 
29
29
  match(object, parents) {
30
- return (0, _insert.isFunction)(object) && object.type != "ArrowFunctionExpression" && !object.$eval;
30
+ return (0, _insert.isFunction)(object) && object.type != "ArrowFunctionExpression" && !object.$eval && !object.$dispatcherSkip;
31
31
  }
32
32
 
33
33
  transform(object, parents) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-confuser",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "JavaScript Obfuscation Tool.",
5
5
  "main": "dist/index.js",
6
6
  "types": "index.d.ts",
@@ -22,7 +22,8 @@ export default class Eval extends Transform {
22
22
  return (
23
23
  isFunction(object) &&
24
24
  object.type != "ArrowFunctionExpression" &&
25
- !object.$eval
25
+ !object.$eval &&
26
+ !object.$dispatcherSkip
26
27
  );
27
28
  }
28
29
 
@@ -48,3 +48,31 @@ it("should move function declarations to the top of the block", async () => {
48
48
 
49
49
  expect(value).toStrictEqual(100);
50
50
  });
51
+
52
+ it("should work with Integrity also enabled", async () => {
53
+ var code = `
54
+ input("Hello World")
55
+ `;
56
+
57
+ var output = await JsConfuser(code, {
58
+ target: "node",
59
+ compact: false,
60
+ eval: true,
61
+ lock: {
62
+ integrity: true,
63
+ },
64
+ });
65
+
66
+ expect(output).toContain("eval(");
67
+
68
+ var value = "never_called",
69
+ input = (valueIn) => (value = valueIn);
70
+
71
+ try {
72
+ eval(output);
73
+ } catch (e) {
74
+ expect(e).toStrictEqual(undefined);
75
+ }
76
+
77
+ expect(value).toStrictEqual("Hello World");
78
+ });