expose-kit 0.2.1 → 0.2.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/README.md CHANGED
@@ -21,8 +21,6 @@ Expose Kit takes *a different path*.
21
21
 
22
22
  Instead of brute force, it works **step by step**.
23
23
 
24
- The goal is simple: **safe and universal toolkit**.
25
-
26
24
  Alongside deobfuscation, Expose Kit includes a collection of practical utilities.
27
25
 
28
26
  Everything you need is documented right here in this [README](README.md).
@@ -38,18 +36,64 @@ Everything you need is documented right here in this [README](README.md).
38
36
  <!-- For Highlight -->
39
37
  ```regex
40
38
  npm i -g expose-kit
39
+ # or
40
+ bun i -g expose-kit
41
41
  ```
42
42
 
43
43
  <!-- For Highlight -->
44
44
  ```regex
45
45
  expose --help
46
+ expose parsable sample.js
46
47
  ```
47
48
 
48
49
  ## Docs
49
- Coming soon...
50
+ By default, the first argument should be the file name (alternatively, `--file` or `--input` can be used).
51
+
52
+ If no options are provided, this tool will prompt you for the required values.
53
+
54
+ To avoid memory leaks and hung processes, a reasonable timeout is set by default.
55
+ When long-running execution is expected, the timeout can be disabled with `--unlimited`.
56
+
57
+ ### Commands
58
+ ---
59
+
60
+ #### `expose parsable`
61
+
62
+ Check if the file is parsable
63
+ ```js
64
+ parsable: const x = 810;
65
+ not parsable: cons x; = 810;
66
+ ```
67
+
68
+ ##### Example
69
+ ```bash
70
+ expose parsable path/to/file.js
71
+ ```
72
+
73
+ ##### Args
74
+ - *Only default args*
75
+
76
+ ---
77
+ #### `expose scope-safe`
78
+
79
+ Rename bindings per scope for safer transforms
80
+ ```js
81
+ Before: var x = 810;((x) => console.log(x))(114514);
82
+ After: var x = 810;((_x) => console.log(_x))(114514);
83
+ ```
84
+
85
+ ##### Example
86
+ ```bash
87
+ expose scope-safe path/to/file.js --output path/to/file.scope-safe.js
88
+ ```
89
+
90
+ ##### Args
91
+ - `--o, --output <file>`: Output file path
92
+ If the input has no extension, `path/to/file.scope-safe.js` is used.
93
+ Otherwise, `path/to/file.scope-safe.<ext>` is used (same directory).
50
94
 
51
95
  ## Authors
52
96
  - [EdamAme-x](https://github.com/EdamAme-x)
53
97
 
54
98
  Built for research, not abuse.
55
- Want stronger obfuscation? Then make something this tool can’t undo.
99
+ Want stronger obfuscation? Then make something this tool can’t reverse.
package/dist/index.js CHANGED
@@ -23,15 +23,29 @@ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
23
23
 
24
24
  // utils/common/createPrompt.ts
25
25
  import chalk from "chalk";
26
+ import readline from "readline";
26
27
  var PREFIX = chalk.bold(chalk.gray("?"));
27
- var createPrompt = (...args) => {
28
+ var _prompt = "prompt" in globalThis ? globalThis.prompt : (question, defaultValue) => {
29
+ const rl = readline.createInterface({
30
+ input: process.stdin,
31
+ output: process.stdout
32
+ });
33
+ return new Promise((resolve) => {
34
+ const q = defaultValue ? `${question} (${defaultValue}): ` : `${question}: `;
35
+ rl.question(q, (answer) => {
36
+ rl.close();
37
+ resolve(answer || defaultValue || "");
38
+ });
39
+ });
40
+ };
41
+ var createPrompt = async (...args) => {
28
42
  const question = args.shift();
29
43
  if (!question) {
30
44
  throw new Error("Question is required");
31
45
  }
32
46
  const defaultAnswer = args.shift();
33
- const answer = defaultAnswer ? prompt(`${PREFIX} ${question}`, defaultAnswer) : prompt(`${PREFIX} ${question}`);
34
- return answer;
47
+ const answer = defaultAnswer ? _prompt(`${PREFIX} ${question}`, defaultAnswer) : _prompt(`${PREFIX} ${question}`);
48
+ return await answer;
35
49
  };
36
50
 
37
51
  // utils/babel/createParseOptions.ts
@@ -75,7 +89,7 @@ var parsable_default = createCommand((program2) => {
75
89
  async (fileArgument, options) => {
76
90
  await timeout(
77
91
  async ({ finish }) => {
78
- const filename = fileArgument ?? options.file ?? createPrompt("Enter the file path:");
92
+ const filename = fileArgument ?? options.file ?? await createPrompt("Enter the file path:");
79
93
  if (!filename) {
80
94
  showError("No file provided");
81
95
  return finish();
@@ -154,7 +168,7 @@ var scope_safe_default = createCommand((program2) => {
154
168
  async (fileArgument, options) => {
155
169
  await timeout(
156
170
  async ({ finish }) => {
157
- const filename = fileArgument ?? options.file ?? createPrompt("Enter the file path:");
171
+ const filename = fileArgument ?? options.file ?? await createPrompt("Enter the file path:");
158
172
  if (!filename) {
159
173
  showError("No file provided");
160
174
  return finish();
@@ -162,7 +176,7 @@ var scope_safe_default = createCommand((program2) => {
162
176
  try {
163
177
  const fileContent = readFileSync2(filename, "utf8");
164
178
  const defaultOutputPath = createDefaultOutputPath(filename);
165
- let outputPath = options.output ?? (createPrompt(
179
+ let outputPath = options.output ?? (await createPrompt(
166
180
  "Enter the output file path:"
167
181
  ) || "").trim() ?? defaultOutputPath;
168
182
  const loader = loading2("Renaming variables by scope...").start();
@@ -205,7 +219,7 @@ var beautify = (strings, ...values) => {
205
219
  return result;
206
220
  };
207
221
  var isNoColor = () => {
208
- return Bun.env.NO_COLOR !== void 0 && Bun.argv.includes("--no-color");
222
+ return process.env.NO_COLOR !== void 0 && process.argv.includes("--no-color");
209
223
  };
210
224
  var calmGradienrain = (text) => {
211
225
  if (isNoColor()) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expose-kit",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expose-kit",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",