expose-kit 0.2.1 → 0.2.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/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).
@@ -43,13 +41,57 @@ npm i -g expose-kit
43
41
  <!-- For Highlight -->
44
42
  ```regex
45
43
  expose --help
44
+ expose parsable sample.js
46
45
  ```
47
46
 
48
47
  ## Docs
49
- Coming soon...
48
+ By default, the first argument should be the file name (alternatively, `--file` or `--input` can be used).
49
+
50
+ If no options are provided, this tool will prompt you for the required values.
51
+
52
+ To avoid memory leaks and hung processes, a reasonable timeout is set by default.
53
+ When long-running execution is expected, the timeout can be disabled with `--unlimited`.
54
+
55
+ ### Commands
56
+ ---
57
+
58
+ #### `expose parsable`
59
+
60
+ Check if the file is parsable
61
+ ```js
62
+ parsable: const x = 810;
63
+ not parsable: cons x; = 810;
64
+ ```
65
+
66
+ ##### Example
67
+ ```bash
68
+ expose parsable path/to/file.js
69
+ ```
70
+
71
+ ##### Args
72
+ - *Only default args*
73
+
74
+ ---
75
+ #### `expose scope-safe`
76
+
77
+ Rename bindings per scope for safer transforms
78
+ ```js
79
+ Before: var x = 810;((x) => console.log(x))(114514);
80
+ After: var x = 810;((_x) => console.log(_x))(114514);
81
+ ```
82
+
83
+ ##### Example
84
+ ```bash
85
+ expose scope-safe path/to/file.js --output path/to/file.scope-safe.js
86
+ ```
87
+
88
+ ##### Args
89
+ - `--o, --output <file>`: Output file path
90
+ If the input has no extension, `path/to/file.scope-safe.js` is used.
91
+ Otherwise, `path/to/file.scope-safe.<ext>` is used (same directory).
50
92
 
51
93
  ## Authors
52
94
  - [EdamAme-x](https://github.com/EdamAme-x)
53
95
 
54
96
  Built for research, not abuse.
55
- Want stronger obfuscation? Then make something this tool can’t undo.
97
+ 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();
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.2",
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.2",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",