expose-kit 0.1.6 → 0.2.1
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/README.md +41 -5
- package/dist/index.js +121 -33
- package/dist/package.json +56 -56
- package/package.json +56 -56
package/README.md
CHANGED
|
@@ -8,12 +8,48 @@
|
|
|
8
8
|
##### <center>❓ Question: Join our [Discord community](https://evex.land)</center>
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
11
|
+
## Concept
|
|
12
|
+
JavaScript deobfuscation tools are *everywhere*.
|
|
13
|
+
<img width="145.2" height="113.5" alt="image" src="https://github.com/relative/synchrony/blob/master/.github/hm.png?raw=true" />
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
But many of them are **too aggressive**, rewriting code until it breaks.
|
|
17
|
+
|
|
13
18
|
<img width="654" height="24" alt="image" src="https://github.com/user-attachments/assets/fd11d250-0163-4cd2-b36c-5514137fe087" />
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
Expose Kit takes *a different path*.
|
|
21
|
+
|
|
22
|
+
Instead of brute force, it works **step by step**.
|
|
23
|
+
|
|
24
|
+
The goal is simple: **safe and universal toolkit**.
|
|
25
|
+
|
|
26
|
+
Alongside deobfuscation, Expose Kit includes a collection of practical utilities.
|
|
27
|
+
|
|
28
|
+
Everything you need is documented right here in this [README](README.md).
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
##### If the feature you’re looking for doesn’t exist, please create an [issue](https://github.com/EdamAme-x/expose-kit/issues).
|
|
33
|
+
##### If you know what you want to do but aren’t sure which feature to use, join our [Discord community](https://evex.land) and ask for help.
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
*Just one step*
|
|
38
|
+
<!-- For Highlight -->
|
|
39
|
+
```regex
|
|
40
|
+
npm i -g expose-kit
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<!-- For Highlight -->
|
|
44
|
+
```regex
|
|
45
|
+
expose --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Docs
|
|
49
|
+
Coming soon...
|
|
17
50
|
|
|
18
|
-
|
|
51
|
+
## Authors
|
|
52
|
+
- [EdamAme-x](https://github.com/EdamAme-x)
|
|
19
53
|
|
|
54
|
+
Built for research, not abuse.
|
|
55
|
+
Want stronger obfuscation? Then make something this tool can’t undo.
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// index.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
|
-
import { dirname, join } from "path";
|
|
5
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
7
|
import chalk4 from "chalk";
|
|
8
8
|
|
|
@@ -71,36 +71,124 @@ var showError = (message) => {
|
|
|
71
71
|
|
|
72
72
|
// commands/parsable/index.ts
|
|
73
73
|
var parsable_default = createCommand((program2) => {
|
|
74
|
-
program2.command("parsable").description("Check if the file is parsable").argument("[file]", "The file to check").option("--file <file>", "The file to check").
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
74
|
+
program2.command("parsable").description("Check if the file is parsable").argument("[file]", "The file to check").option("--input, --file <file>", "The file to check").option("--unlimited", "Unlimited timeout").action(
|
|
75
|
+
async (fileArgument, options) => {
|
|
76
|
+
await timeout(
|
|
77
|
+
async ({ finish }) => {
|
|
78
|
+
const filename = fileArgument ?? options.file ?? createPrompt("Enter the file path:");
|
|
79
|
+
if (!filename) {
|
|
80
|
+
showError("No file provided");
|
|
81
|
+
return finish();
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const fileContent = readFileSync(filename, "utf8");
|
|
85
|
+
const loader = loading(
|
|
86
|
+
"Checking if the file is parsable..."
|
|
87
|
+
).start();
|
|
88
|
+
try {
|
|
89
|
+
parse(fileContent, createParseOptions(filename));
|
|
90
|
+
await sleep(500);
|
|
91
|
+
loader.succeed("File is parsable");
|
|
92
|
+
return finish();
|
|
93
|
+
} catch (error) {
|
|
94
|
+
loader.fail("File is not parsable");
|
|
95
|
+
showError(
|
|
96
|
+
`Error parsing file '${filename}': ${error instanceof Error ? error.message : "Unknown error"}`
|
|
97
|
+
);
|
|
98
|
+
return finish();
|
|
99
|
+
}
|
|
100
|
+
} catch (error) {
|
|
101
|
+
showError(
|
|
102
|
+
`Error reading file '${filename}': ${error instanceof Error ? error.message : "Unknown error"}`
|
|
103
|
+
);
|
|
104
|
+
return finish();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
options.unlimited ? Infinity : 30 * 1e3
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// commands/scope-safe/index.ts
|
|
114
|
+
import { readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
115
|
+
import { basename, dirname, extname, join } from "path";
|
|
116
|
+
import { parse as parse2 } from "@babel/parser";
|
|
117
|
+
import traverse from "@babel/traverse";
|
|
118
|
+
import generate from "@babel/generator";
|
|
119
|
+
import loading2 from "loading-cli";
|
|
120
|
+
var createDefaultOutputPath = (inputPath) => {
|
|
121
|
+
const ext = extname(inputPath);
|
|
122
|
+
if (!ext) {
|
|
123
|
+
return `${inputPath}.scope-safe.js`;
|
|
124
|
+
}
|
|
125
|
+
const base = basename(inputPath, ext);
|
|
126
|
+
return join(dirname(inputPath), `${base}.scope-safe${ext}`);
|
|
127
|
+
};
|
|
128
|
+
var renameBindingsByScope = (code, filename) => {
|
|
129
|
+
const ast = parse2(code, createParseOptions(filename));
|
|
130
|
+
const renamedBindings = /* @__PURE__ */ new Set();
|
|
131
|
+
traverse(ast, {
|
|
132
|
+
Scopable(path) {
|
|
133
|
+
for (const [name, binding] of Object.entries(path.scope.bindings)) {
|
|
134
|
+
if (renamedBindings.has(binding)) {
|
|
135
|
+
continue;
|
|
95
136
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
137
|
+
const shouldRename = !!path.scope.parent?.hasBinding(name);
|
|
138
|
+
if (!shouldRename) {
|
|
139
|
+
renamedBindings.add(binding);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const newName = path.scope.generateUid(name);
|
|
143
|
+
if (newName !== name) {
|
|
144
|
+
path.scope.rename(name, newName);
|
|
145
|
+
}
|
|
146
|
+
renamedBindings.add(binding);
|
|
101
147
|
}
|
|
102
|
-
}
|
|
148
|
+
}
|
|
103
149
|
});
|
|
150
|
+
return generate(ast).code;
|
|
151
|
+
};
|
|
152
|
+
var scope_safe_default = createCommand((program2) => {
|
|
153
|
+
program2.command("scope-safe").description("Rename bindings per scope for safer transforms").argument("[file]", "The file to transform").option("--input, --file <file>", "The file to transform").option("--o, --output <file>", "Output file path").option("--unlimited", "Unlimited timeout").action(
|
|
154
|
+
async (fileArgument, options) => {
|
|
155
|
+
await timeout(
|
|
156
|
+
async ({ finish }) => {
|
|
157
|
+
const filename = fileArgument ?? options.file ?? createPrompt("Enter the file path:");
|
|
158
|
+
if (!filename) {
|
|
159
|
+
showError("No file provided");
|
|
160
|
+
return finish();
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
const fileContent = readFileSync2(filename, "utf8");
|
|
164
|
+
const defaultOutputPath = createDefaultOutputPath(filename);
|
|
165
|
+
let outputPath = options.output ?? (createPrompt(
|
|
166
|
+
"Enter the output file path:"
|
|
167
|
+
) || "").trim() ?? defaultOutputPath;
|
|
168
|
+
const loader = loading2("Renaming variables by scope...").start();
|
|
169
|
+
try {
|
|
170
|
+
const output = renameBindingsByScope(fileContent, filename);
|
|
171
|
+
writeFileSync(outputPath, output, "utf8");
|
|
172
|
+
loader.succeed(`Saved scope-safe file to: ${outputPath}`);
|
|
173
|
+
return finish();
|
|
174
|
+
} catch (error) {
|
|
175
|
+
loader.fail("Failed to apply scope-safe transform");
|
|
176
|
+
showError(
|
|
177
|
+
`Error transforming file '${filename}': ${error instanceof Error ? error.message : "Unknown error"}`
|
|
178
|
+
);
|
|
179
|
+
return finish();
|
|
180
|
+
}
|
|
181
|
+
} catch (error) {
|
|
182
|
+
showError(
|
|
183
|
+
`Error reading file '${filename}': ${error instanceof Error ? error.message : "Unknown error"}`
|
|
184
|
+
);
|
|
185
|
+
return finish();
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
options.unlimited ? Infinity : 120 * 1e3
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
);
|
|
104
192
|
});
|
|
105
193
|
|
|
106
194
|
// utils/cli/showCredit.ts
|
|
@@ -117,7 +205,7 @@ var beautify = (strings, ...values) => {
|
|
|
117
205
|
return result;
|
|
118
206
|
};
|
|
119
207
|
var isNoColor = () => {
|
|
120
|
-
return
|
|
208
|
+
return Bun.env.NO_COLOR !== void 0 && Bun.argv.includes("--no-color");
|
|
121
209
|
};
|
|
122
210
|
var calmGradienrain = (text) => {
|
|
123
211
|
if (isNoColor()) {
|
|
@@ -154,10 +242,10 @@ ${calmGradienrain(`Expose Kit v${VERSION}`)}
|
|
|
154
242
|
`;
|
|
155
243
|
|
|
156
244
|
// index.ts
|
|
157
|
-
import { readFileSync as
|
|
245
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
158
246
|
var __filename = fileURLToPath(import.meta.url);
|
|
159
|
-
var __dirname =
|
|
160
|
-
var pkg = JSON.parse(
|
|
247
|
+
var __dirname = dirname2(__filename);
|
|
248
|
+
var pkg = JSON.parse(readFileSync3(join2(__dirname, "package.json"), "utf8"));
|
|
161
249
|
console.log(showCredit(pkg.version));
|
|
162
250
|
console.log();
|
|
163
251
|
var program = new Command();
|
|
@@ -166,7 +254,7 @@ program.name("expose").description("CLI for Deobfuscating").version(
|
|
|
166
254
|
"-v, --version",
|
|
167
255
|
"display version number"
|
|
168
256
|
);
|
|
169
|
-
var commands = [parsable_default];
|
|
257
|
+
var commands = [parsable_default, scope_safe_default];
|
|
170
258
|
for (const command of commands) {
|
|
171
259
|
command(program);
|
|
172
260
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
2
|
+
"name": "expose-kit",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/EdamAme-x/expose-kit.git"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org",
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://evex.land",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "bun test",
|
|
19
|
+
"format": "biome format .",
|
|
20
|
+
"format:fix": "biome format --write .",
|
|
21
|
+
"lint": "biome lint .",
|
|
22
|
+
"lint:fix": "biome lint --write .",
|
|
23
|
+
"copy": "bun run utils/common/cp.ts package.json dist/package.json",
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"postbuild": "publint",
|
|
26
|
+
"prepublishOnly": "bun copy",
|
|
27
|
+
"release": "bun run build && np"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@biomejs/biome": "2.3.11",
|
|
31
|
+
"@types/bun": "latest",
|
|
32
|
+
"publint": "^0.3.16",
|
|
33
|
+
"tsup": "^8.5.1"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"typescript": "^5"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@babel/generator": "^7.28.5",
|
|
40
|
+
"@babel/parser": "^7.28.5",
|
|
41
|
+
"@babel/traverse": "^7.28.5",
|
|
42
|
+
"@babel/types": "^7.28.5",
|
|
43
|
+
"@types/babel__generator": "^7.27.0",
|
|
44
|
+
"@types/babel__traverse": "^7.28.0",
|
|
45
|
+
"chalk": "^5.6.2",
|
|
46
|
+
"commander": "^14.0.2",
|
|
47
|
+
"loading-cli": "^1.1.2"
|
|
48
|
+
},
|
|
49
|
+
"bin": {
|
|
50
|
+
"expose": "dist/index.js",
|
|
51
|
+
"expose-kit": "dist/index.js",
|
|
52
|
+
"expose-js": "dist/index.js",
|
|
53
|
+
"exposejs": "dist/index.js"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist"
|
|
57
|
+
]
|
|
58
58
|
}
|
package/package.json
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
2
|
+
"name": "expose-kit",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/EdamAme-x/expose-kit.git"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org",
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://evex.land",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "bun test",
|
|
19
|
+
"format": "biome format .",
|
|
20
|
+
"format:fix": "biome format --write .",
|
|
21
|
+
"lint": "biome lint .",
|
|
22
|
+
"lint:fix": "biome lint --write .",
|
|
23
|
+
"copy": "bun run utils/common/cp.ts package.json dist/package.json",
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"postbuild": "publint",
|
|
26
|
+
"prepublishOnly": "bun copy",
|
|
27
|
+
"release": "bun run build && np"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@biomejs/biome": "2.3.11",
|
|
31
|
+
"@types/bun": "latest",
|
|
32
|
+
"publint": "^0.3.16",
|
|
33
|
+
"tsup": "^8.5.1"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"typescript": "^5"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@babel/generator": "^7.28.5",
|
|
40
|
+
"@babel/parser": "^7.28.5",
|
|
41
|
+
"@babel/traverse": "^7.28.5",
|
|
42
|
+
"@babel/types": "^7.28.5",
|
|
43
|
+
"@types/babel__generator": "^7.27.0",
|
|
44
|
+
"@types/babel__traverse": "^7.28.0",
|
|
45
|
+
"chalk": "^5.6.2",
|
|
46
|
+
"commander": "^14.0.2",
|
|
47
|
+
"loading-cli": "^1.1.2"
|
|
48
|
+
},
|
|
49
|
+
"bin": {
|
|
50
|
+
"expose": "dist/index.js",
|
|
51
|
+
"expose-kit": "dist/index.js",
|
|
52
|
+
"expose-js": "dist/index.js",
|
|
53
|
+
"exposejs": "dist/index.js"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist"
|
|
57
|
+
]
|
|
58
58
|
}
|