diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index ee6729e..2715609 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -16,7 +16,12 @@ A clear and concise description of what you expected to happen. **To Reproduce** Steps to reproduce the behavior: -If your problem is a non-working obfuscated file, please also include a minimal source code example, your config file as well as the output file that you got. +Please include: +- A **minimal reproducible example** shared via the Prometheus Web playground: https://prometheus-lua.github.io/Prometheus/ +- Your config (preset/custom config) +- The produced output (or relevant excerpt/error) + +If your problem is a non-working obfuscated file, the minimal source code example is required. **Screenshots** If applicable, add screenshots to help explain your problem. diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 132338a..cdf7e7c 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -31,8 +31,8 @@ jobs: cache: pnpm - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Build web - run: pnpm --filter web build + - name: Build web + docs + run: pnpm run web:build - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/.gitignore b/.gitignore index 1a3a7be..4107fb9 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ node_modules web/node_modules web/dist web/dist-ssr +web/public/docs web/test-results web/playwright-report .vite diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..cea7e9e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Contributing to Prometheus + +Thanks for contributing to Prometheus. + +## Requirements + +- Keep pull requests focused and small where possible. +- Follow the existing project style and structure. +- Ensure your changes do not break existing tests and behavior. +- Add or update tests when changing behavior. +- Document user-visible changes clearly. + +## Reporting Bugs + +When opening a bug report, include: + +- Clear bug description +- Expected behavior +- Steps to reproduce +- A minimal reproducible example shared via the Prometheus Web playground: https://prometheus-lua.github.io/Prometheus/ +- Config used (preset/custom config) +- Produced output and relevant errors/logs +- Environment details (OS, Lua/LuaJIT version) + +Bug reports without a reproducible minimal example may be closed until reproducible information is provided. + +## Contributing New Steps / Features + +If a new step or feature might break existing scripts: + +- It must be clearly documented as potentially breaking. +- It must not be added to any default pipeline. +- It should only be available through custom configuration. + +When proposing such a change, include migration guidance and examples for users. diff --git a/README.md b/README.md index d8e1ed5..9228b6e 100644 --- a/README.md +++ b/README.md @@ -133,11 +133,13 @@ Focused on real obfuscation passes useful for shipped Lua applications. You can find the full documentation, including the getting started guide, here:
+Contribution guidelines: [CONTRIBUTING.md](CONTRIBUTING.md) + --- ### Requirements @@ -167,7 +169,7 @@ return(function(...)local L={"afT6mf1V","/7mJXsuvmE1c/fT3";"tn1ZSn6=","37ghSJM=" -- remaining obfuscated output omitted ``` -For more advanced use cases, configuration, and presets, see the [documentation](https://levno-710.gitbook.io/prometheus/). +For more advanced use cases, configuration, and presets, see the [documentation](https://prometheus-lua.github.io/Prometheus/docs/). --- diff --git a/doc/README.md b/doc/README.md index 5899437..4668691 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,11 +1,36 @@ --- -description: Prometheus is an Lua Obfuscator, that is written in pure Lua. +description: Prometheus is a Lua obfuscator written in pure Lua. --- -# Prometheus +# Prometheus Documentation -Prometheus can obfuscate Lua51 as well as Roblox's LuaU, which is an optionally typed superset of Lua51. +Prometheus obfuscates Lua source code using AST transforms and a configurable pipeline. -View Prometheus on [github](https://github.com/levno-710/Prometheus). +Use the [Prometheus Webapp](https://prometheus-lua.github.io/Prometheus/) to quickly try out settings and test small snippets. For larger scripts and advanced workflows, use the CLI (`prometheus-lua` or `cli.lua`). -This Documentation only applies to the newest version of Prometheus. +This documentation covers: + +- CLI usage (`prometheus-lua` and `cli.lua`) +- configuration and presets +- all built-in obfuscation steps +- embedding Prometheus as a library + +## Who this is for + +- Lua developers shipping scripts where source readability is a concern +- users integrating Prometheus in build pipelines +- developers embedding Prometheus into another Lua application + +## Supported language targets + +- Lua 5.1 (`Lua51`) +- LuaU (`LuaU`) + +## Read in this order + +1. Installation +2. Quickstart +3. CLI Usage +4. Presets +5. Custom Config +6. Step Reference diff --git a/doc/SUMMARY.md b/doc/SUMMARY.md index a47a360..e5bcbf1 100644 --- a/doc/SUMMARY.md +++ b/doc/SUMMARY.md @@ -1,27 +1,36 @@ # Table of contents -* [Prometheus](README.md) +* [Prometheus Documentation](README.md) ## Getting Started * [Installation](getting-started/installation.md) -* [Obfuscating your first script](getting-started/obfuscating-your-first-script.md) -* [Command Line Options](getting-started/command-line-options.md) -* [Presets](getting-started/presets.md) -* [Writing a custom Config File](getting-started/writing-a-custom-config-file.md) -* [The Config Object](getting-started/the-config-object.md) - -## Steps - -* [WrapInFunction](steps/wrapinfunction.md) -* [Vmify](steps/vmify.md) -* [SplitStrings](steps/splitstrings.md) -* [ProxifyLocals](steps/proxifylocals.md) -* [EncryptStrings](steps/encryptstrings.md) -* [ConstantArray](steps/constantarray.md) -* [AntiTamper](steps/anti-tamper.md) - - -## advanced - -* [Using Prometheus in your Lua Application](advanced/using-prometheus-in-your-lua-application.md) +* [Quickstart: First Obfuscation](getting-started/quickstart-first-obfuscation.md) +* [Troubleshooting](getting-started/troubleshooting.md) + +## Guides + +* [CLI Usage](guides/cli-usage.md) +* [Presets](guides/presets.md) +* [Writing a Custom Config](guides/writing-a-custom-config.md) +* [Using Prometheus as a Library](guides/using-as-a-library.md) + +## Reference + +* [CLI Options Reference](reference/cli-options.md) +* [Config Object Reference](reference/config-object.md) +* [Step Pipeline Overview](reference/steps/overview.md) +* [Step: WrapInFunction](reference/steps/wrapinfunction.md) +* [Step: Vmify](reference/steps/vmify.md) +* [Step: SplitStrings](reference/steps/splitstrings.md) +* [Step: ProxifyLocals](reference/steps/proxifylocals.md) +* [Step: EncryptStrings](reference/steps/encryptstrings.md) +* [Step: ConstantArray](reference/steps/constantarray.md) +* [Step: AntiTamper](reference/steps/anti-tamper.md) +* [Step: NumbersToExpressions](reference/steps/numberstoexpressions.md) +* [Step: AddVararg](reference/steps/addvararg.md) +* [Step: WatermarkCheck](reference/steps/watermarkcheck.md) + +## Advanced + +* [How the Pipeline Works](advanced/how-the-pipeline-works.md) diff --git a/doc/advanced/how-the-pipeline-works.md b/doc/advanced/how-the-pipeline-works.md new file mode 100644 index 0000000..d067ea2 --- /dev/null +++ b/doc/advanced/how-the-pipeline-works.md @@ -0,0 +1,27 @@ +# How the Pipeline Works + +Execution flow in `Pipeline:apply`: + +1. Seed random generator (`Seed` or generated seed) +2. Parse source to AST +3. Apply configured steps in order +4. Rename variables +5. Unparse AST to Lua code + +## Seeding details + +- If `Seed > 0`: uses that fixed seed. +- Else Prometheus attempts `openssl rand -hex 12` for entropy. +- If OpenSSL is unavailable, it falls back to `os.time()` and logs a warning. + +## Variable renaming + +After all steps finish, Prometheus renames identifiers using: + +- selected `NameGenerator` +- configured `VarNamePrefix` +- language keyword table for selected `LuaVersion` + +## Logging + +Pipeline emits informational logs for each phase and step timing, including output size relative to source. diff --git a/doc/advanced/using-prometheus-in-your-lua-application.md b/doc/advanced/using-prometheus-in-your-lua-application.md deleted file mode 100644 index ed1fb98..0000000 --- a/doc/advanced/using-prometheus-in-your-lua-application.md +++ /dev/null @@ -1,31 +0,0 @@ -# Using Prometheus in your Lua Application - -Prometheus can also be used as a library for your custom Lua Applications instead of using its cli tool. - -In order to do that you'll first need to clone the github repo: - -```batch -git clone "https://github.com/levno-710/Prometheus.git" -``` - -After that, you'll need to copy everything within the src folder to your project. Let's say you created a folder named `prometheus`, where all the Prometheus files are located. You can the use the following code to obfuscate a string: - -{% code title="use_prometheus.lua" %} -```lua -local Prometheus = require("prometheus.prometheus") - --- If you don't want console output -Prometheus.Logger.logLevel = Prometheus.Logger.LogLevel.Error - --- Your code -local code = 'print("Hello, World!")' - --- Create a Pipeline using the Strong preset -local pipeline = Prometheus.Pipeline:fromConfig(Prometheus.Presets.Strong) - --- Apply the obfuscation and print the result -print(pipeline:apply(code)); -``` -{% endcode %} - -Instead of passing the Strong preset you could also pass a custom [Config Object](../getting-started/the-config-object.md). diff --git a/doc/book.json b/doc/book.json new file mode 100644 index 0000000..40dcc71 --- /dev/null +++ b/doc/book.json @@ -0,0 +1,6 @@ +{ + "title": "Prometheus Docs", + "styles": { + "website": "styles/website.css" + } +} diff --git a/doc/getting-started/command-line-options.md b/doc/getting-started/command-line-options.md deleted file mode 100644 index 637c904..0000000 --- a/doc/getting-started/command-line-options.md +++ /dev/null @@ -1,13 +0,0 @@ -# Command Line Options - -The following table provides a brief overview over the command line options: - -| Option | Usage | -| ----------------------------- | ----------------------------------------------------------- | -| --preset \[name]; --p \[name] | Specify the config preset to be used; [Details](presets.md) | -| --config \[path]; --c \[path] | Specify the path to a custom config file | -| --out \[path]; --o \[path] | Specify the path of the output file | -| --nocolors | Disable ansi colors escape sequences | -| --Lua51 | Handle input as Lua 5.1 | -| --LuaU | Handle input as LuaU | -| --pretty | Pretty print the output | diff --git a/doc/getting-started/installation.md b/doc/getting-started/installation.md index 01bde29..2421a0e 100644 --- a/doc/getting-started/installation.md +++ b/doc/getting-started/installation.md @@ -2,32 +2,38 @@ ## Linux and macOS (recommended) -Install the latest release: +Install latest release: ```bash curl -fsSL https://raw.githubusercontent.com/prometheus-lua/Prometheus/master/install.sh | sh ``` -Verify: +Verify installation: ```bash prometheus-lua --version ``` -Release bundles include a Lua runtime, so no separate Lua install is needed for installed CLI usage. - Update later: ```bash prometheus-lua update ``` +The release bundle includes a Lua runtime (`runtime/lua`), so you do not need a separate Lua install for packaged CLI usage. + ## From source ```bash -git clone "https://github.com/prometheus-lua/Prometheus.git" +git clone https://github.com/prometheus-lua/Prometheus.git cd Prometheus -./prometheus-lua --preset Medium ./your_file.lua +lua ./cli.lua --version +``` + +Then run obfuscation: + +```bash +lua ./cli.lua --preset Medium ./your_file.lua ``` -For source usage, Prometheus requires LuaJIT or Lua 5.1+. +For source usage, Prometheus expects a Lua runtime (LuaJIT, `lua5.1`, or `lua`). diff --git a/doc/getting-started/obfuscating-your-first-script.md b/doc/getting-started/obfuscating-your-first-script.md deleted file mode 100644 index 2a74193..0000000 --- a/doc/getting-started/obfuscating-your-first-script.md +++ /dev/null @@ -1,50 +0,0 @@ -# Obfuscating your first script - -Now that you have downloaded and Prometheus, you probably wonder how to use it. In this quick tutorial you are going to learn how to obfuscate your first file. - -Note that in the following command examples `lua` should be replaced by your lua implementation. - -Create the following file within the Prometheus main directory that you just downloaded: - -{% code title="hello_world.lua" %} -```lua -print("Hello, World") -``` -{% endcode %} - -Now run the following command inside of the Prometheus directory: - -```batch -lua ./cli.lua ./hello_world.lua -``` - -You may notice, that the console output looks weird. If that is the case, your terminal does not support ansi color escape sequences. You should add the `--nocolors` option: - -```batch -lua ./cli.lua --nocolors ./hello_world.lua -``` - -This should create the following file: - -{% code title="hello_world.obfuscated.lua" %} -```lua -print("Hello, World") -``` -{% endcode %} - -As you can see, the file hasn't changed at all. That is because by default prometheus is just a minifier and the code we gave it was already as small as possible. To actually obfuscate the file, prometheus must be told which obfuscation steps it should apply in which order. In order to do this, the cli provides the `--preset` option which allows you to specify the name of a predefined configuration. There are currently the following presets: - -* Minify -* Weak -* Medium -* Strong - -In order to perform the obfuscation, you need to specify that Prometheus should use the Strong preset: - -```batch -lua ./cli.lua --preset Medium ./hello_world.lua -``` - -The `hello_world.obfuscated.lua` should now contain the obfuscated code that should still print "Hello World". - -Note that using the "Strong" preset is not recommended for large projects. diff --git a/doc/getting-started/presets.md b/doc/getting-started/presets.md deleted file mode 100644 index b601e5c..0000000 --- a/doc/getting-started/presets.md +++ /dev/null @@ -1,10 +0,0 @@ -# Presets - -The following table provides an overview over the presets - -| name | size | speed | -| ------ | ------ | ------- | -| Minify | tiny | fastest | -| Weak | small | fast | -| Medium | medium | medium | -| Strong | huge | slowest | diff --git a/doc/getting-started/quickstart-first-obfuscation.md b/doc/getting-started/quickstart-first-obfuscation.md new file mode 100644 index 0000000..38b249d --- /dev/null +++ b/doc/getting-started/quickstart-first-obfuscation.md @@ -0,0 +1,32 @@ +# Quickstart: First Obfuscation + +You can quickly try Prometheus in the [Prometheus Webapp](https://prometheus-lua.github.io/Prometheus/). For large scripts or advanced use cases, prefer the CLI workflow below. + +Create a simple Lua file: + +```lua +print("Hello, World") +``` + +Run Prometheus from the repository root: + +```bash +lua ./cli.lua --preset Medium ./hello.lua +``` + +Prometheus will write: + +- `hello.obfuscated.lua` (default output path) + +Run the result with your Lua runtime to validate behavior. + +## Important default behavior + +- If you do not pass `--preset` or `--config`, Prometheus uses `Minify`. +- `Minify` performs minification only (no obfuscation steps). + +## Choosing a preset quickly + +- `Weak`: low overhead +- `Medium`: practical default +- `Strong`: strongest built-in preset, highest overhead diff --git a/doc/getting-started/the-config-object.md b/doc/getting-started/the-config-object.md deleted file mode 100644 index 4df718e..0000000 --- a/doc/getting-started/the-config-object.md +++ /dev/null @@ -1,56 +0,0 @@ -# The Config Object - -Prometheus takes a configuration object. In this object there can be many properties applied. \ -The following table provides an overview: - -| Property | type | possible values | default | -| ------------- | ------- | -------------------------------------------- | ----------------- | -| LuaVersion | string | "Lua51", "LuaU" | "Lua51" | -| PrettyPrint | boolean | true, false | false | -| VarNamePrefix | string | any | "" | -| NameGenerator | string | "Mangled", "MangledShuffled", "Il", "Number" | "MangledShuffled" | -| Seed | number | any | 0 | -| Steps | table | StepConfig\[] | {} | - -As this table shows, all properties in the config object are optional as they have a default value. - -As an example, here is the code for the minify preset: - -```lua -{ - -- The default LuaVersion is Lua51 - LuaVersion = "Lua51"; - -- For minifying no VarNamePrefix is applied - VarNamePrefix = ""; - -- Name Generator for Variables - NameGenerator = "MangledShuffled"; - -- No pretty printing - PrettyPrint = false; - -- Seed is generated based on current time - Seed = 0; - -- No obfuscation steps - Steps = {} -}; -``` - -### Steps - -The most important property is the Steps property. This property must be a table of so called Step Configs. A Step in Prometheus describes a single transformation applied to your script by the Prometheus obfuscation pipeline. A StepConfiguration consists of the Name of the Step as well as settings for the step. All Steps will later be applied in the order they are defined. A single Step can be defined twice and will then be applied twice. - -```lua --- Obfuscation steps -Steps = { - { - -- This obfuscation step puts all constants into an array at the beginning of the code - Name = "ConstantArray"; - Settings = { - -- Apply to Strings only - StringsOnly = true; - -- Apply to all Constants, 0.5 would only affect 50% of strings - Threshold = 1; - } - }, -} -``` - -Under [Steps](broken-reference), you can find all current Steps, their names as well as the possible options. diff --git a/doc/getting-started/troubleshooting.md b/doc/getting-started/troubleshooting.md new file mode 100644 index 0000000..5f7385a --- /dev/null +++ b/doc/getting-started/troubleshooting.md @@ -0,0 +1,38 @@ +# Troubleshooting + +## `No Lua runtime found` + +This comes from `prometheus-lua` when it cannot find: + +1. bundled runtime at `runtime/lua` +2. `luajit` +3. `lua5.1` +4. `lua` + +Install one of these runtimes or reinstall with the installer. + +## ANSI color output looks broken + +Use: + +```bash +--nocolors +``` + +## Parser errors are hard to inspect + +Use: + +```bash +--saveerrors +``` + +Prometheus will write `.error.txt` next to your input file. + +## `The Step "..." was not found` + +Your step `Name` does not match a registered step constructor. Use names documented in [Step Pipeline Overview](../reference/steps/overview.md). + +## `PrettyPrint` with `AntiTamper` + +`AntiTamper` is skipped when `PrettyPrint = true`. Prometheus logs a warning and continues. diff --git a/doc/getting-started/writing-a-custom-config-file.md b/doc/getting-started/writing-a-custom-config-file.md deleted file mode 100644 index ada5f6b..0000000 --- a/doc/getting-started/writing-a-custom-config-file.md +++ /dev/null @@ -1,56 +0,0 @@ -# Writing a custom Config File - -Configuration Files for Prometheus are just lua modules, that return a single object, which contains the configuration. Let's say we have the following config file: - -{% code title="config.lua" %} -```lua -return { - -- The default LuaVersion is Lua51 - LuaVersion = "Lua51"; -- or "LuaU" - -- All Variables will start with this prefix - VarNamePrefix = ""; - -- Name Generator for Variables that look like this: b, a, c, D, t, G - NameGenerator = "MangledShuffled"; - -- No pretty printing - PrettyPrint = false; - -- Seed is generated based on current time - -- When specifying a seed that is not 0, you will get the same output every time - Seed = 0; - -- Obfuscation steps - Steps = { - { - -- This obfuscation step puts all constants into an array at the beginning of the code - Name = "ConstantArray"; - Settings = { - -- Apply to Strings only - StringsOnly = true; - -- Apply to all Constants, 0.5 would only affect 50% of strings - Threshold = 1; - } - }, - } - } -``` -{% endcode %} - -One can now obfuscate a script using this configuration by running: - -```batch -lua ./cli.lua --config config.lua hello_world.lua -``` - -You should get the following output: - -{% code title="hello_world.obfuscated.lua" %} -```lua -local N={"Hello, World!"}local function k(k)return N[k+40058]end print(k(-40057)) -``` -{% endcode %} - -As you can see, the only transformation that was applied to our Hello World example was putting all strings (in this case only `"Hello, World!"` ) into an array and creating a wrapper function for retrieving the value. - -### How does the Config File work? - -The config file is simply a lua file, that returns the configuration object. Please note that this lua file is sandboxed by Prometheus when loading the configuration, meaning that you can't use any predefined functions like `tostring` or libraries like `math`. - -See [The Config Object](the-config-object.md) to learn what this configuration object consists of. diff --git a/doc/guides/cli-usage.md b/doc/guides/cli-usage.md new file mode 100644 index 0000000..aeddc02 --- /dev/null +++ b/doc/guides/cli-usage.md @@ -0,0 +1,53 @@ +# CLI Usage + +## Entry points + +- packaged CLI: `prometheus-lua` +- source CLI: `lua ./cli.lua` + +Both call the same CLI implementation (`src/cli.lua`). + +## Basic usage + +```bash +prometheus-lua --preset Medium ./input.lua +``` + +## Output file behavior + +If `--out` is not provided: + +- `input.lua` -> `input.obfuscated.lua` +- `input` -> `input.obfuscated.lua` + +## Common workflows + +Use a preset: + +```bash +prometheus-lua --preset Strong ./src/main.lua +``` + +Use a custom config file: + +```bash +prometheus-lua --config ./prometheus.config.lua ./src/main.lua +``` + +Force Lua target: + +```bash +prometheus-lua --preset Medium --LuaU ./src/main.lua +``` + +Enable pretty output: + +```bash +prometheus-lua --preset Minify --pretty ./src/main.lua +``` + +## Notes + +- Unknown `--...` options are ignored with a warning. +- If no config/preset is passed, Prometheus falls back to `Minify`. +- `update` command uses the official installer script from GitHub. diff --git a/doc/guides/presets.md b/doc/guides/presets.md new file mode 100644 index 0000000..61537c0 --- /dev/null +++ b/doc/guides/presets.md @@ -0,0 +1,58 @@ +# Presets + +Prometheus ships with these preset names in `src/presets.lua`: + +- `Minify` +- `Weak` +- `Vmify` (test-oriented helper preset) +- `Medium` +- `Strong` + +Use with: + +```bash +prometheus-lua --preset Medium ./file.lua +``` + +## Minify + +- no step transforms (`Steps = {}`) +- variable renaming still applies through pipeline settings +- best for size reduction and minimal runtime overhead + +## Weak + +Steps: + +1. `Vmify` +2. `ConstantArray` +3. `WrapInFunction` + +## Medium + +Steps: + +1. `EncryptStrings` +2. `AntiTamper` (`UseDebug = false`) +3. `Vmify` +4. `ConstantArray` +5. `NumbersToExpressions` +6. `WrapInFunction` + +## Strong + +Steps: + +1. `Vmify` +2. `EncryptStrings` +3. `AntiTamper` (`UseDebug = false`) +4. `Vmify` +5. `ConstantArray` +6. `NumbersToExpressions` +7. `WrapInFunction` + +## Choosing quickly + +- Start with `Medium`. +- Move to `Strong` only after benchmarking your runtime path. +- Use `Minify` when you want readability reduction only through compression/renaming style behavior. diff --git a/doc/guides/using-as-a-library.md b/doc/guides/using-as-a-library.md new file mode 100644 index 0000000..82e2a6d --- /dev/null +++ b/doc/guides/using-as-a-library.md @@ -0,0 +1,41 @@ +# Using Prometheus as a Library + +Prometheus can be required directly from Lua. + +## In this repository + +```lua +local Prometheus = require("src.prometheus") + +local code = 'print("Hello")' +local pipeline = Prometheus.Pipeline:fromConfig(Prometheus.Presets.Medium) +local out = pipeline:apply(code, "inline-source.lua") +print(out) +``` + +## Integration in another project + +Copy the `src/` tree and make sure `require` can resolve `src.prometheus` (or adapt your `package.path` to where `prometheus.lua` is located). + +## Useful runtime controls + +Disable noisy logs: + +```lua +Prometheus.Logger.logLevel = Prometheus.Logger.LogLevel.Error +``` + +Enable syntax highlighting in unparser output: + +```lua +local pipeline = Prometheus.Pipeline:new({ + LuaVersion = "Lua51", + PrettyPrint = false, + Highlight = true, +}) +``` + +## Notes + +- `pipeline:apply` expects source code text. +- If `apply` is called with no filename, logs use `Anonymous Script`. diff --git a/doc/guides/writing-a-custom-config.md b/doc/guides/writing-a-custom-config.md new file mode 100644 index 0000000..09a7be0 --- /dev/null +++ b/doc/guides/writing-a-custom-config.md @@ -0,0 +1,51 @@ +# Writing a Custom Config + +Prometheus accepts a Lua config file via `--config`. + +```bash +prometheus-lua --config ./prometheus.config.lua ./input.lua +``` + +## File format + +The config file must be executable Lua code that returns a table: + +```lua +return { + LuaVersion = "Lua51", + PrettyPrint = false, + VarNamePrefix = "", + NameGenerator = "MangledShuffled", + Seed = 0, + Steps = { + { Name = "EncryptStrings", Settings = {} }, + { Name = "Vmify", Settings = {} }, + { Name = "WrapInFunction", Settings = { Iterations = 1 } }, + } +} +``` + +## Step ordering matters + +`Steps` are applied in order. The same step can appear multiple times. + +## Name generator values + +Supported string values (from `src/prometheus/namegenerators.lua`): + +- `Mangled` +- `MangledShuffled` +- `Il` +- `Number` +- `Confuse` + +## Reproducibility + +- `Seed > 0`: deterministic RNG seed +- `Seed <= 0`: randomized seed (OpenSSL if available, else current time) + +## Common mistakes + +- Misspelled step names in `Name` +- wrong setting types (for example string instead of number) +- invalid `VarNamePrefix` for the selected Lua version diff --git a/doc/reference/cli-options.md b/doc/reference/cli-options.md new file mode 100644 index 0000000..c95d485 --- /dev/null +++ b/doc/reference/cli-options.md @@ -0,0 +1,28 @@ +# CLI Options Reference + +## Commands + +| Command | Description | +| --- | --- | +| `update` | Runs official installer script to install latest release | +| `--version`, `-v` | Prints version (`PROMETHEUS_LUA_VERSION` or `dev`) | +| `--help`, `-h`, `help` | Prints CLI help | + +## Obfuscation options + +| Option | Alias | Argument | Description | +| --- | --- | --- | --- | +| `--preset` | `--p` | `The Type of Function code injection This Option only applies when custom Concatenation is selected.
Note that when choosing inline, the code size may increase significantly!