lua-obfuscator 1.0.0 → 1.0.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/.github/workflows/release.yml +40 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -18
- package/dist/prometheus/LICENSE +661 -661
- package/dist/prometheus/build.bat +9 -9
- package/dist/prometheus/doc/README.md +11 -11
- package/dist/prometheus/doc/SUMMARY.md +27 -27
- package/dist/prometheus/doc/advanced/using-prometheus-in-your-lua-application.md +31 -31
- package/dist/prometheus/doc/getting-started/command-line-options.md +13 -13
- package/dist/prometheus/doc/getting-started/installation.md +11 -11
- package/dist/prometheus/doc/getting-started/obfuscating-your-first-script.md +50 -50
- package/dist/prometheus/doc/getting-started/presets.md +10 -10
- package/dist/prometheus/doc/getting-started/the-config-object.md +58 -58
- package/dist/prometheus/doc/getting-started/writing-a-custom-config-file.md +56 -56
- package/dist/prometheus/doc/steps/anti-tamper.md +11 -11
- package/dist/prometheus/doc/steps/constantarray.md +71 -71
- package/dist/prometheus/doc/steps/encryptstrings.md +86 -86
- package/dist/prometheus/doc/steps/proxifylocals.md +47 -47
- package/dist/prometheus/doc/steps/splitstrings.md +40 -40
- package/dist/prometheus/doc/steps/vmify.md +9 -9
- package/dist/prometheus/doc/steps/wrapinfunction.md +29 -29
- package/dist/prometheus/readme.md +57 -57
- package/dist/prometheus/readme.txt +4 -4
- package/package.json +5 -1
- package/src/index.ts +93 -75
- package/tsconfig.json +12 -12
- package/src/prometheus/.editorconfig +0 -4
- package/src/prometheus/.gitattributes +0 -2
- package/src/prometheus/.gitbook.yaml +0 -1
- package/src/prometheus/.github/ISSUE_TEMPLATE/bug_report.md +0 -25
- package/src/prometheus/.github/workflows/Build.yml +0 -49
- package/src/prometheus/.github/workflows/Test.yml +0 -19
- package/src/prometheus/LICENSE +0 -661
- package/src/prometheus/benchmark.lua +0 -34
- package/src/prometheus/build.bat +0 -10
- package/src/prometheus/cli.lua +0 -12
- package/src/prometheus/doc/README.md +0 -11
- package/src/prometheus/doc/SUMMARY.md +0 -27
- package/src/prometheus/doc/advanced/using-prometheus-in-your-lua-application.md +0 -31
- package/src/prometheus/doc/getting-started/command-line-options.md +0 -13
- package/src/prometheus/doc/getting-started/installation.md +0 -11
- package/src/prometheus/doc/getting-started/obfuscating-your-first-script.md +0 -50
- package/src/prometheus/doc/getting-started/presets.md +0 -10
- package/src/prometheus/doc/getting-started/the-config-object.md +0 -58
- package/src/prometheus/doc/getting-started/writing-a-custom-config-file.md +0 -56
- package/src/prometheus/doc/steps/anti-tamper.md +0 -11
- package/src/prometheus/doc/steps/constantarray.md +0 -71
- package/src/prometheus/doc/steps/encryptstrings.md +0 -86
- package/src/prometheus/doc/steps/proxifylocals.md +0 -47
- package/src/prometheus/doc/steps/splitstrings.md +0 -40
- package/src/prometheus/doc/steps/vmify.md +0 -9
- package/src/prometheus/doc/steps/wrapinfunction.md +0 -29
- package/src/prometheus/prometheus-main.lua +0 -1
- package/src/prometheus/readme.md +0 -57
- package/src/prometheus/readme.txt +0 -5
- package/src/prometheus/src/cli.lua +0 -154
- package/src/prometheus/src/colors.lua +0 -61
- package/src/prometheus/src/highlightlua.lua +0 -61
- package/src/prometheus/src/logger.lua +0 -62
- package/src/prometheus/src/presets.lua +0 -174
- package/src/prometheus/src/prometheus/ast.lua +0 -792
- package/src/prometheus/src/prometheus/bit.lua +0 -521
- package/src/prometheus/src/prometheus/compiler/compiler.lua +0 -2365
- package/src/prometheus/src/prometheus/enums.lua +0 -106
- package/src/prometheus/src/prometheus/namegenerators/Il.lua +0 -41
- package/src/prometheus/src/prometheus/namegenerators/confuse.lua +0 -169
- package/src/prometheus/src/prometheus/namegenerators/mangled.lua +0 -26
- package/src/prometheus/src/prometheus/namegenerators/mangled_shuffled.lua +0 -35
- package/src/prometheus/src/prometheus/namegenerators/number.lua +0 -11
- package/src/prometheus/src/prometheus/namegenerators.lua +0 -7
- package/src/prometheus/src/prometheus/parser.lua +0 -969
- package/src/prometheus/src/prometheus/pipeline.lua +0 -250
- package/src/prometheus/src/prometheus/randomLiterals.lua +0 -41
- package/src/prometheus/src/prometheus/randomStrings.lua +0 -24
- package/src/prometheus/src/prometheus/scope.lua +0 -332
- package/src/prometheus/src/prometheus/step.lua +0 -79
- package/src/prometheus/src/prometheus/steps/AddVararg.lua +0 -33
- package/src/prometheus/src/prometheus/steps/AntiTamper.lua +0 -194
- package/src/prometheus/src/prometheus/steps/ConstantArray.lua +0 -521
- package/src/prometheus/src/prometheus/steps/EncryptStrings.lua +0 -239
- package/src/prometheus/src/prometheus/steps/NumbersToExpressions.lua +0 -82
- package/src/prometheus/src/prometheus/steps/ProxifyLocals.lua +0 -313
- package/src/prometheus/src/prometheus/steps/SplitStrings.lua +0 -338
- package/src/prometheus/src/prometheus/steps/Vmify.lua +0 -30
- package/src/prometheus/src/prometheus/steps/Watermark.lua +0 -61
- package/src/prometheus/src/prometheus/steps/WatermarkCheck.lua +0 -50
- package/src/prometheus/src/prometheus/steps/WrapInFunction.lua +0 -45
- package/src/prometheus/src/prometheus/steps.lua +0 -12
- package/src/prometheus/src/prometheus/tokenizer.lua +0 -546
- package/src/prometheus/src/prometheus/unparser.lua +0 -866
- package/src/prometheus/src/prometheus/util.lua +0 -297
- package/src/prometheus/src/prometheus/visitast.lua +0 -245
- package/src/prometheus/src/prometheus.lua +0 -71
- package/src/prometheus/tests/closures.lua +0 -12
- package/src/prometheus/tests/fibonacci.lua +0 -10
- package/src/prometheus/tests/loops.lua +0 -8
- package/src/prometheus/tests/primes.lua +0 -18
- package/src/prometheus/tests.lua +0 -149
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
|
|
23
|
+
- run: npm install -g npm@latest
|
|
24
|
+
- run: npm ci
|
|
25
|
+
|
|
26
|
+
- name: Check Version
|
|
27
|
+
id: check
|
|
28
|
+
run: |
|
|
29
|
+
PUBLISHED=$(npm view lua-obfuscator version 2>/dev/null || echo "0.0.0")
|
|
30
|
+
LOCAL=$(node -p "require('./package.json').version")
|
|
31
|
+
echo "local=$LOCAL / published=$PUBLISHED"
|
|
32
|
+
if [ "$PUBLISHED" != "$LOCAL" ]; then
|
|
33
|
+
echo "should_publish=true" >> "$GITHUB_OUTPUT"
|
|
34
|
+
else
|
|
35
|
+
echo "should_publish=false" >> "$GITHUB_OUTPUT"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
- name: Publish
|
|
39
|
+
if: steps.check.outputs.should_publish == 'true'
|
|
40
|
+
run: npm publish
|
package/dist/index.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ interface PrometheusConfig {
|
|
|
10
10
|
[key: string]: unknown;
|
|
11
11
|
}>;
|
|
12
12
|
}
|
|
13
|
-
export declare function obfuscate(text: string, config?: PrometheusPreset | PrometheusConfig): Promise<string>;
|
|
13
|
+
export declare function obfuscate(text: string, config?: PrometheusPreset | PrometheusConfig, luaVersion?: 'Lua51' | 'LuaU'): Promise<string>;
|
|
14
14
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -5,22 +5,31 @@ import { fileURLToPath } from 'url';
|
|
|
5
5
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
const prometheusPath = path.join(__dirname, '../dist/prometheus');
|
|
7
7
|
const factory = new LuaFactory();
|
|
8
|
-
|
|
8
|
+
let mountPromise = null;
|
|
9
|
+
async function mountDirectory(dir, prefix = '') {
|
|
9
10
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
10
11
|
for (const entry of entries) {
|
|
11
12
|
const fullPath = path.join(dir, entry.name);
|
|
12
13
|
const luaPath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
13
14
|
if (entry.isDirectory()) {
|
|
14
|
-
mountDirectory(fullPath, luaPath);
|
|
15
|
+
await mountDirectory(fullPath, luaPath);
|
|
15
16
|
}
|
|
16
17
|
else if (entry.name.endsWith('.lua')) {
|
|
17
|
-
|
|
18
|
-
factory.mountFile(luaPath, fs.readFileSync(fullPath));
|
|
18
|
+
await factory.mountFile(luaPath, fs.readFileSync(fullPath));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
function ensureMounted() {
|
|
23
|
+
if (!mountPromise) {
|
|
24
|
+
mountPromise = mountDirectory(prometheusPath).catch(err => {
|
|
25
|
+
mountPromise = null;
|
|
26
|
+
throw err;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return mountPromise;
|
|
30
|
+
}
|
|
31
|
+
export async function obfuscate(text, config = 'Strong', luaVersion) {
|
|
32
|
+
await ensureMounted();
|
|
24
33
|
const lua = await factory.createEngine();
|
|
25
34
|
try {
|
|
26
35
|
await lua.doString(`arg = {}`);
|
|
@@ -34,18 +43,23 @@ export async function obfuscate(text, config = 'Strong') {
|
|
|
34
43
|
lua.global.set('__custom_config', config);
|
|
35
44
|
configExpr = '__custom_config';
|
|
36
45
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Prometheus
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
lua.global.set('__lua_version', luaVersion ?? null);
|
|
47
|
+
const obfuscated = await lua.doString(`
|
|
48
|
+
local Prometheus = require("src.prometheus")
|
|
49
|
+
Prometheus.Logger.logLevel = Prometheus.Logger.LogLevel.Error
|
|
50
|
+
|
|
51
|
+
local cfg = ${configExpr}
|
|
52
|
+
if cfg == nil then
|
|
53
|
+
error("Invalid preset or config")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
if __lua_version ~= nil then
|
|
57
|
+
cfg.LuaVersion = __lua_version
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
local pipeline = Prometheus.Pipeline:fromConfig(cfg)
|
|
61
|
+
local result = pipeline:apply(__input_code)
|
|
62
|
+
return result
|
|
49
63
|
`);
|
|
50
64
|
if (typeof obfuscated !== 'string') {
|
|
51
65
|
throw new Error('Prometheus returned invalid result');
|