expose-kit 0.0.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/LICENSE +21 -0
- package/README.md +19 -0
- package/biome.jsonc +34 -0
- package/commands/parsable/index.ts +58 -0
- package/index.ts +33 -0
- package/package.json +48 -0
- package/tsconfig.json +31 -0
- package/utils/babel/createParseOptions.ts +11 -0
- package/utils/cli/createCommand.ts +7 -0
- package/utils/cli/showCredit.ts +67 -0
- package/utils/common/createPrompt.ts +13 -0
- package/utils/common/showError.ts +5 -0
- package/utils/common/sleep.ts +2 -0
- package/utils/common/timeout.ts +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EdamAmex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Expose Kit
|
|
2
|
+

|
|
3
|
+
[](https://discord.gg/evex)
|
|
4
|
+
|
|
5
|
+
> A universal toolkit for deobfuscating JavaScript
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
##### <center>❓ Question: Join our [Discord community](https://evex.land)</center>
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Concepts
|
|
12
|
+
Many *tools* currently exist, but most of them perform dangerous transformations and **break the code**.
|
|
13
|
+
<img width="654" height="24" alt="image" src="https://github.com/user-attachments/assets/fd11d250-0163-4cd2-b36c-5514137fe087" />
|
|
14
|
+
|
|
15
|
+
With *this tool*, we aim to minimize the possibility of code breakage by step-by-step performing individual tasks
|
|
16
|
+
such as *safely separating scopes* and *expanding string tables* and more.
|
|
17
|
+
|
|
18
|
+
Additionally, we offer various other useful tools. Everything is written in this [README](README.md).
|
|
19
|
+
|
package/biome.jsonc
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": true
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false
|
|
10
|
+
},
|
|
11
|
+
"formatter": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"indentStyle": "tab"
|
|
14
|
+
},
|
|
15
|
+
"linter": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"rules": {
|
|
18
|
+
"recommended": true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"javascript": {
|
|
22
|
+
"formatter": {
|
|
23
|
+
"quoteStyle": "double"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"assist": {
|
|
27
|
+
"enabled": true,
|
|
28
|
+
"actions": {
|
|
29
|
+
"source": {
|
|
30
|
+
"organizeImports": "on"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createCommand } from "@/utils/cli/createCommand";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { parse } from "@babel/parser";
|
|
4
|
+
import loading from "loading-cli";
|
|
5
|
+
import { sleep } from "@/utils/common/sleep";
|
|
6
|
+
import { createPrompt } from "@/utils/common/createPrompt";
|
|
7
|
+
import { createParseOptions } from "@/utils/babel/createParseOptions";
|
|
8
|
+
import { timeout } from "@/utils/common/timeout";
|
|
9
|
+
import { showError } from "@/utils/common/showError";
|
|
10
|
+
|
|
11
|
+
export default createCommand((program) => {
|
|
12
|
+
program
|
|
13
|
+
.command("parsable")
|
|
14
|
+
.description("Check if the file is parsable")
|
|
15
|
+
.argument("[file]", "The file to check")
|
|
16
|
+
.option("--file <file>", "The file to check")
|
|
17
|
+
.action(async (fileArgument, options: { file?: string }) => {
|
|
18
|
+
await timeout(async ({ finish }) => {
|
|
19
|
+
const filename =
|
|
20
|
+
fileArgument ?? options.file ?? createPrompt("Enter the file path:");
|
|
21
|
+
|
|
22
|
+
if (!filename) {
|
|
23
|
+
showError("No file provided");
|
|
24
|
+
return finish();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const fileContent = readFileSync(filename, "utf8");
|
|
29
|
+
const loader = loading("Checking if the file is parsable...").start();
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
parse(fileContent, createParseOptions(filename));
|
|
33
|
+
|
|
34
|
+
// Patch memory
|
|
35
|
+
await sleep(500);
|
|
36
|
+
loader.succeed("File is parsable");
|
|
37
|
+
|
|
38
|
+
return finish();
|
|
39
|
+
} catch (error: unknown) {
|
|
40
|
+
loader.fail("File is not parsable");
|
|
41
|
+
showError(
|
|
42
|
+
`Error parsing file '${filename}': ${
|
|
43
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
44
|
+
}`
|
|
45
|
+
);
|
|
46
|
+
return finish();
|
|
47
|
+
}
|
|
48
|
+
} catch (error: unknown) {
|
|
49
|
+
showError(
|
|
50
|
+
`Error reading file '${filename}': ${
|
|
51
|
+
error instanceof Error ? error.message : "Unknown error"
|
|
52
|
+
}`
|
|
53
|
+
);
|
|
54
|
+
return finish();
|
|
55
|
+
}
|
|
56
|
+
}, 30 * 1000);
|
|
57
|
+
});
|
|
58
|
+
});
|
package/index.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import parsable from "@/commands/parsable";
|
|
6
|
+
import { showCredit } from "@/utils/cli/showCredit";
|
|
7
|
+
import pkg from "./package.json" with { type: "json" };
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
|
|
12
|
+
// Read version from package.json
|
|
13
|
+
console.log(showCredit(pkg.version));
|
|
14
|
+
console.log();
|
|
15
|
+
|
|
16
|
+
const program = new Command();
|
|
17
|
+
|
|
18
|
+
program
|
|
19
|
+
.name("expose")
|
|
20
|
+
.description("CLI for Deobfuscating")
|
|
21
|
+
.version(
|
|
22
|
+
chalk.bold("It's written above, lol"),
|
|
23
|
+
"-v, --version",
|
|
24
|
+
"display version number",
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const commands = [parsable];
|
|
28
|
+
|
|
29
|
+
for (const command of commands) {
|
|
30
|
+
command(program);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "expose-kit",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"module": "index.ts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/EdamAme-x/expose-kit.git"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"registry": "https://registry.npmjs.org",
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://evex.land",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"format": "biome format **/*.ts",
|
|
20
|
+
"format:fix": "biome format --write **/*.ts",
|
|
21
|
+
"lint": "biome lint **/*.ts",
|
|
22
|
+
"lint:fix": "biome lint --write **/*.ts"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@biomejs/biome": "2.3.11",
|
|
26
|
+
"@types/bun": "latest"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"typescript": "^5"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@babel/generator": "^7.28.5",
|
|
33
|
+
"@babel/parser": "^7.28.5",
|
|
34
|
+
"@babel/traverse": "^7.28.5",
|
|
35
|
+
"@babel/types": "^7.28.5",
|
|
36
|
+
"@types/babel__generator": "^7.27.0",
|
|
37
|
+
"@types/babel__traverse": "^7.28.0",
|
|
38
|
+
"chalk": "^5.6.2",
|
|
39
|
+
"commander": "^14.0.2",
|
|
40
|
+
"loading-cli": "^1.1.2"
|
|
41
|
+
},
|
|
42
|
+
"bin": {
|
|
43
|
+
"expose": "dist/index.js",
|
|
44
|
+
"expose-kit": "dist/index.js",
|
|
45
|
+
"expose-js": "dist/index.js",
|
|
46
|
+
"exposejs": "dist/index.js"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
|
|
11
|
+
// Bundler mode
|
|
12
|
+
"moduleResolution": "bundler",
|
|
13
|
+
"allowImportingTsExtensions": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
// Best practices
|
|
18
|
+
"strict": true,
|
|
19
|
+
"skipLibCheck": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"noUncheckedIndexedAccess": true,
|
|
22
|
+
|
|
23
|
+
// Some stricter flags (disabled by default)
|
|
24
|
+
"noUnusedLocals": false,
|
|
25
|
+
"noUnusedParameters": false,
|
|
26
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
27
|
+
"paths": {
|
|
28
|
+
"@/*": ["./*"]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParserOptions } from "@babel/parser";
|
|
2
|
+
|
|
3
|
+
export const createParseOptions = (filename: string) => {
|
|
4
|
+
const isTypeScript = filename.endsWith(".ts") || filename.endsWith(".tsx");
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
sourceType: "module",
|
|
8
|
+
allowAwaitOutsideFunction: true,
|
|
9
|
+
plugins: isTypeScript ? ["typescript", "jsx"] : ["jsx"],
|
|
10
|
+
} as ParserOptions;
|
|
11
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
|
|
3
|
+
// `\naaa\n` => `aaa`
|
|
4
|
+
const beautify = <T>(strings: TemplateStringsArray, ...values: T[]) => {
|
|
5
|
+
let result = "";
|
|
6
|
+
for (let i = 0; i < strings.length; i++) {
|
|
7
|
+
result += strings[i];
|
|
8
|
+
if (i < values.length) {
|
|
9
|
+
result += values[i];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
result = result.replace(/^\s*\n/, "").replace(/\n\s*$/, "");
|
|
13
|
+
return result;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const isNoColor = () => {
|
|
17
|
+
return (
|
|
18
|
+
process.env.NO_COLOR !== undefined && process.argv.includes("--no-color")
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const calmGradienrain = (text: string) => {
|
|
23
|
+
if (isNoColor()) {
|
|
24
|
+
return text;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const startHue = 210;
|
|
28
|
+
const endHue = 300;
|
|
29
|
+
const saturation = 0.45;
|
|
30
|
+
const value = 0.8;
|
|
31
|
+
|
|
32
|
+
const ease = (t: number) => t * t * (3 - 2 * t);
|
|
33
|
+
|
|
34
|
+
return text
|
|
35
|
+
.split("")
|
|
36
|
+
.map((char, i) => {
|
|
37
|
+
const t = ease(i / Math.max(text.length - 1, 1));
|
|
38
|
+
const hue = startHue + (endHue - startHue) * t;
|
|
39
|
+
|
|
40
|
+
const c = value * saturation;
|
|
41
|
+
const h = hue / 60;
|
|
42
|
+
const x = c * (1 - Math.abs((h % 2) - 1));
|
|
43
|
+
const m = value - c;
|
|
44
|
+
|
|
45
|
+
let r = 0,
|
|
46
|
+
g = 0,
|
|
47
|
+
b = 0;
|
|
48
|
+
|
|
49
|
+
if (h < 1) [r, g, b] = [c, x, 0];
|
|
50
|
+
else if (h < 2) [r, g, b] = [x, c, 0];
|
|
51
|
+
else if (h < 3) [r, g, b] = [0, c, x];
|
|
52
|
+
else if (h < 4) [r, g, b] = [0, x, c];
|
|
53
|
+
else if (h < 5) [r, g, b] = [x, 0, c];
|
|
54
|
+
else [r, g, b] = [c, 0, x];
|
|
55
|
+
|
|
56
|
+
return chalk.rgb(
|
|
57
|
+
Math.round((r + m) * 255),
|
|
58
|
+
Math.round((g + m) * 255),
|
|
59
|
+
Math.round((b + m) * 255),
|
|
60
|
+
)(char);
|
|
61
|
+
})
|
|
62
|
+
.join("");
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const showCredit = (VERSION: string) => beautify`
|
|
66
|
+
${calmGradienrain(`Expose Kit v${VERSION}`)}
|
|
67
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
|
|
3
|
+
const PREFIX = chalk.bold(chalk.gray("?"));
|
|
4
|
+
|
|
5
|
+
export const createPrompt = (...args: Parameters<typeof prompt>) => {
|
|
6
|
+
const question = args.shift();
|
|
7
|
+
if (!question) {
|
|
8
|
+
throw new Error("Question is required");
|
|
9
|
+
}
|
|
10
|
+
const defaultAnswer = args.shift();
|
|
11
|
+
const answer = defaultAnswer ? prompt(`${PREFIX} ${question}`, defaultAnswer) : prompt(`${PREFIX} ${question}`);
|
|
12
|
+
return answer;
|
|
13
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const timeout = (
|
|
2
|
+
fn: (ctx: { finish: () => void; aborted: () => boolean }) => void | Promise<void>,
|
|
3
|
+
ms: number
|
|
4
|
+
) => {
|
|
5
|
+
let aborted = false;
|
|
6
|
+
const { resolve, reject, promise } = Promise.withResolvers<void>();
|
|
7
|
+
|
|
8
|
+
const timer = setTimeout(() => {
|
|
9
|
+
aborted = true;
|
|
10
|
+
reject(new Error("Hang detected, please report to the developer"));
|
|
11
|
+
}, ms);
|
|
12
|
+
|
|
13
|
+
const finish = () => {
|
|
14
|
+
clearTimeout(timer);
|
|
15
|
+
resolve();
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
fn({
|
|
19
|
+
finish,
|
|
20
|
+
aborted: () => aborted,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return promise;
|
|
24
|
+
};
|