Skip to content
FracitalPublic

About

ECMAScript code obfuscator, built in Rust on OXC

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

estrogen

@sysce/estrogen

npm CI license: ISC GitHub issues GitHub stars

A post-build web obfuscator. It takes a directory a bundler already produced and rewrites the JS, HTML and SVG in place. In app scripts it pools strings, template literals and regex patterns, disguises number and boolean literals as equivalent expressions, and shortens local names. In vendor scripts it replaces proxy and store names, plus the matching names in embedded wasm. It leaves no sensitive plaintext from the canary list, and it does not change what the code does.

It also assembles the build it protects. estrogen build vendors packages and folders, from node_modules or a glob, into the served tree under per-build stamped names, obfuscating them on the way in or copying them verbatim, from a [[vendor]] config. estrogen --watch re-runs on each change, and --sourcemap <dir> writes a private V3 source map outside the served tree. estrogen runs as a command line tool, as esbuild, rsbuild, Vite and Rollup plugins, and as an Astro integration.

estrogen is written in Rust on OXC and published to npm as @sysce/estrogen. The binary is estrogen.

estrogen transforms a shipped build into something more fun to read for crawlers.

Try it in your browser at estro.help: the real engine compiled to WebAssembly, running locally on what you paste. Nothing is uploaded.

Install

npm i -D @sysce/estrogen

The package pulls the matching per-target binary (@sysce/estrogen-<os>-<cpu>) as an optional dependency. Supported targets: linux x64 and arm64, darwin x64 and arm64, win32 x64.

A nightly build of main is published under the nightly dist-tag, versioned like 0.5.9-nightly.202611230617.g1a2b3c4 (UTC time and commit), once a day when main has a new commit that passed CI:

npm i -D @sysce/estrogen@nightly

Quick start

Run it over a built directory from the command line:

npx estrogen dist

Or run it after an esbuild build, over the output directory:

import estrogen from '@sysce/estrogen/esbuild';
import { build } from 'esbuild';

await build({
	entryPoints: ['src/index.ts'],
	bundle: true,
	outdir: 'dist',
	plugins: [estrogen()],
});

Or add it to an Astro build, where it runs on astro:build:done over the output directory:

import estrogen from '@sysce/estrogen/astro';
import { defineConfig } from 'astro/config';

export default defineConfig({
	integrations: [estrogen()],
});

Run estrogen on fresh bundler output. A later pass recognizes its own comment header or existing generated code structure and skips protected files. Use --no-header, [options] header = false, or the Node option header: false to omit the default generated by https://estro.help comment. Decoder-backed output remains safe to repeat and check; decoder-less no-header output needs a fresh build. Changed options or canary lists need a fresh build too.

To bring packages into the build as well, run estrogen build dist with a [[vendor]] config. See the CLI reference.

Benchmarks

estrogen and javascript-obfuscator 5.10.1 build the same inputs, and each build runs in its own Node 24.19.0 process on a Ryzen 9 7950X. The suite is ten small workloads in bench/workloads (median of 5 processes, 10 timed calls each); the library row is Prettier 3.10.1's browser build, 610 KB of minified ES modules, formatting one file 20 times (median of 3 processes). javascript-obfuscator runs its three shipped presets unchanged, debugProtection and disableConsoleOutput included. Every build returns the same result as the original, and the VM compiled every file it was given. The method and full tables are in docs/BENCHMARKS.md; npm run bench reruns it.

estrogen, VM estrogen, --no-vm javascript-obfuscator, default medium high
Suite, slowdown (geomean) 22.9x 2.29x 1.19x 5.75x 8.14x
Suite, gzip size (geomean) 19.6x 2.88x 1.87x 15.2x 61.7x
Suite, build of 10 files 12 ms 9 ms 330 ms 746 ms 1,436 ms
Prettier, format 20 times (native 12 ms) 276 ms 28 ms 16 ms 124 ms 393 ms
Prettier, gzip (native 169 KB) 316 KB 326 KB 296 KB 1,320 KB 3,263 KB
Prettier, import (native 14 ms) 67 ms 33 ms 21 ms 147 ms 522 ms
Prettier, build 75 ms 36 ms 2,753 ms 6,170 ms 10,378 ms

estrogen builds 27 to 140 times faster: Prettier takes 75 ms through the VM and 10.4 s through the high preset. The default preset costs the least at run time, 1.19x on the suite, and leaves strings readable in a plain string array; --no-vm encrypts every string for 2.29x.

The VM is the slowest on the small workloads, 22.9x, because each one is a tight loop that runs every instruction through the interpreter. On Prettier it runs at 22x, ahead of the high preset's 32x, and its output is smaller: 316 KB gzip against 3,263 KB, and 1.9x native against the high preset's 19x. On the small workloads the VM's size is mostly the runtime, about 9 KB gzip per file, which --shared-runtime ships once for a build of ES modules. Hot code can leave the VM with --no-vm-glob.

Geometric mean slowdown, gzip size and build time for each tool and preset Prettier format time, gzip size and build time for each tool and preset Steady-state slowdown against native for each workload, tool and preset

Compared with javascript-obfuscator

javascript-obfuscator 5.10.1 is the open-source package. Its bytecode VM and HTML parsing are Pro features of obfuscator.io: the source is uploaded to its cloud API, which needs a paid token, so the benchmark above runs the local package.

Technique estrogen javascript-obfuscator
Bytecode VM Local, on by default, opcode bytes shuffled per build Pro only, compiled on obfuscator.io's servers
String literals Every string in a ChaCha20 pool, keyed per file String array; base64 or RC4 is opt-in (RC4 in the high preset), 75% of strings by default
Template literals Static parts pooled; regex patterns pooled too Rewritten to concat calls; parts pooled at the string array threshold
Property names Static member names and object keys pooled Member names through the string array; object keys with transformObjectKeys
Number and boolean literals Rewritten as xor, sum and difference expressions, !0, !![] numbersToExpressions (medium and high presets); !![], ![]
Local names Shortened; module top-level bindings too Hexadecimal or mangled; renameGlobals and renameProperties opt-in
Control flow flattening No separate pass; VM code runs as bytecode Yes (medium and high presets)
Dead code injection No Yes (medium and high presets)
Self-defending, anti-debug No selfDefending, debugProtection, disableConsoleOutput, domainLock
Function.toString VM functions print [native code], in every realm the page opens Prints the obfuscated source
HTML and SVG Inline scripts, markup pass, HTML, SVG and CSS minified Pro only (parseHtml)
Proxy runtimes and wasm Proxy and store names replaced, plus the matching names in embedded wasm No
Input A built output directory, rewritten in place; fails closed; canary check A source string, file or directory of scripts
Vendoring estrogen build copies packages into the build under stamped names No
Source maps Private V3 maps written outside the served tree Inline or separate
Reproducible output --seed seed
Integrations esbuild, rsbuild, Vite and Rollup plugins and an Astro integration in the package; --watch webpack, Rollup, gulp and Grunt plugins as separate packages; esbuild and Vite plugins by third parties
Implementation Rust on OXC, one native binary per platform, files in parallel TypeScript on Node
In the browser estro.help, the engine as WebAssembly, run locally obfuscator.io
License ISC BSD-2-Clause

Documentation

  • Text cloak and live injector: per-request ciphertext, framework components, Ctrl+E overlays and opt-in frontend build inputs.
  • CLI reference: every flag, examples, exit codes, the fail-closed rule.
  • Node API: obfuscate(), the esbuild, rsbuild, Vite and Rollup plugins, the Astro integration, the options object, the Report shape.
  • Rust API: the estrogen-core public surface.
  • Integration: esbuild, rsbuild, Vite, Rollup, Astro, and a plain CLI step in package.json.
  • Benchmarks: what the VM and the literal pool cost at run time and load, per workload, and the harness in bench/.
  • Project status: current validation and remaining compatibility work.
  • Proxy name rename: the [proxy] table, the vendor and build scopes, keep, and the text a rename must not change.
  • Proxy integration coverage: per-site builds, browser evidence, VM percentages and remaining gaps.
  • Wiki: install, configuration, source maps, security and limits, contributing.

Powering

SiteLinkRepo
abstract v2 abstract v2 abstracteducation.loan
Fracital Fracital fracit.al Fracital/Fracital
SystemYA SystemYA systemya.fracit.al Fracital/SystemYA
STomp STomp (powerMouse) stomp.fracit.al Fracital/powerMouse
Holy Unblocker Holy Unblocker holyunb.locker holy-unblocker/website2

Credits

GitHub Name
e9x's avatar @e9x David Reed

License

ISC. See LICENSE.

About

ECMAScript code obfuscator, built in Rust on OXC

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages