SpartanB312/Grunt
Sobre
Industrial-aimed JVM obfuscator with native transpiler
Ciência e engenhariaO que você pode fazer
- Control flow - ControlflowFlattening, ControlflowJump, ControlflowFlatteningSSA - Dispatcher-based flattening, opaque branches, fake paths and experimental SSA region flattening.
- IR diagnostics - FlowIRRoundTrip, SSARoundTrip - Import/export methods through the IRs to inspect conversion and verification behavior.
- Constants and arithmetic - NumberBasicEncrypt, StringArrayedEncrypt, ArithmeticSubstitute - Replace numeric constants and arithmetic expressions; move strings into encrypted pools with generated decoding code. StringArrayedEncrypt is displayed as StringBasicEncrypt.
- Call redirection - InvokeProxy, FieldAccessProxy, InvokeDispatcher - Add method/field access proxies and combine calls behind dispatchers.
Crescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- -1
- em 15 dias
- -1
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalGrunteon
English · 正體中文 · 简体中文 · Deutsch · Русский · 日本語
A JVM bytecode obfuscator and transformation framework written in Kotlin — the third generation of Grunt.
Grunteon combines a parallel transformation pipeline, Flow IR and SSA IR, and an integrated C++/JNI native pipeline. It reshapes JVM control flow, encrypts constants, hides references, renames classes and members, and compiles selected methods into native libraries packaged inside the output JAR. A Compose desktop editor and a JSON CLI use the same engine; an optional HTTP backend provides queued jobs.
Grunteon 3.0.0 is under development. Work on this generation began in November 2025. See development status for experimental features and unfinished work.
Contents
- Features
- Control flow and IR
- Native obfuscation
- Pipeline
- Quick start
- Extensions
- Repository structure
- Development status
- Documentation
- Community
- License
- Stargazers over time
Features
The built-in registry contains 38 transformers, including diagnostics and post-processing. Yapyap and GLSL add 4 optional transformers. Each entry has its own configuration and position in the pipeline.
| Area | Transformers | Function |
|---|---|---|
| Control flow | ControlflowFlattening, ControlflowJump, ControlflowFlatteningSSA |
Dispatcher-based flattening, opaque branches, fake paths and experimental SSA region flattening. |
| IR diagnostics | FlowIRRoundTrip, SSARoundTrip |
Import/export methods through the IRs to inspect conversion and verification behavior. |
| Constants and arithmetic | NumberBasicEncrypt, StringArrayedEncrypt, ArithmeticSubstitute |
Replace numeric constants and arithmetic expressions; move strings into encrypted pools with generated decoding code. StringArrayedEncrypt is displayed as StringBasicEncrypt. |
| Call redirection | InvokeProxy, FieldAccessProxy, InvokeDispatcher |
Add method/field access proxies and combine calls behind dispatchers. |
| Renaming | ClassRenamer, FieldRenamer, MethodRenamer, LocalVarRenamer, MixinClassRenamer, MixinFieldRenamer |
Rename classes and members using configurable dictionaries, method-hierarchy analysis and dedicated Mixin handling. |
| Runtime material and decoys | RuntimeMaterial, AntiLLM |
Generate environment-sensitive key material for reference obfuscation, or inject analysis-decoy strings, annotations and resources. |
| Optimization and cleanup | ClassShrink, DeadCodeRemove, EnumOptimize, KotlinClassShrink, MethodInliner, SourceDebugInfoHide, StringEqualsOptimize |
Strip selected metadata and redundant instructions, inline eligible methods and apply specialized enum/string rewrites. |
| Fields, parameters and extra classes | DeclaredFieldsExtract, ParameterObfuscate, TrashClassGenerator |
Move eligible static constant initializers into <clinit>, obscure parameter types and generate extra classes. |
| Reflection and class structure | ReflectionSupport, ReferenceObfuscate, DecompilerCrasher, FakeSyntheticBridge, ShuffleMembers, Watermark |
Preserve/remap recognized reflection literals; hide method references through invokedynamic; alter metadata, flags and member order; add watermarks. |
| Native preparation | NativePreProcessor, NativeCandidate |
Bridge dynamic JVM operations through Java helpers and mark methods for native compilation. |
| Resource post-processing | PostProcess |
Remap entry points in the manifest, plugin.yml, bungee.yml, fabric.mod.json and velocity-plugin.json; remove internal transformation markers. |
Class/member filters and naming dictionaries control transformation scope and generated names. The desktop editor exposes registered configuration types, including plugin settings, and saves jobs as JSON. The user guide explains each setting, its default, accepted values and practical limits.
Control flow and IR
Flow IR retains JVM instructions, stack/local frames, control-flow edges and exception regions. ControlflowFlattening selects a region and groups blocks by compatible entry frames into dispatcher islands. State bridges redirect incoming edges through the dispatchers. Options include state-key computation in generated processor methods, fake switch cases, shared junk terminators, block shuffling and unrelated blocks below dispatcher switches.
ControlflowJump adds opaque branches, mangled conditional jumps, fake loops, dispatcher landing junk and optional exception bridges. Predicate processors can use runtime random bounds while preserving a known branch result. Generated state-key and predicate helpers can also be marked for the native stage.
SSA IR models values and block arguments explicitly. It supports experimental region flattening and the native backend's direct scalar translation path. Flow/SSA round-trip passes provide diagnostics; control-flow passes also offer bytecode verification and method-size or complexity limits.
Implementation: Flow graph · Flow flattener · Jump transformer · SSA representation
Native obfuscation
The native pipeline runs after JVM transformations. NativePreProcessor moves invokedynamic, ConstantDynamic and selected MethodHandle calls into Java bridge helpers. NativeCandidate rules or inclusion annotations select methods; the scanner and validator determine which can be translated.
The C++ backend has three lowering paths:
| Path | Scope | Generated implementation |
|---|---|---|
PrimitiveInt |
A restricted subset of static int methods |
Direct integer expressions with limited runtime dependencies. |
SsaDirect |
Eligible static primitive-scalar methods with SSA | C++ variables and control flow derived from SSA values, branches and block arguments. |
FullJvm |
Supported instance/static methods, references, fields, calls, arrays, exceptions and monitors | JVM instructions lowered to C++ with JNI helpers; proxies for interface methods and class initializers. |
The runtime includes class/member handle caches, local-reference tracking, exception dispatch, monitor handling and primitive intrinsics. Generated C++ can be split across source files. Compiler modes cover GNU-style compilers, MSVC-style compilers and Zig; Zig provides Windows, Linux and macOS presets for x86-64 and AArch64.
After successful compilation, Grunteon embeds the libraries, injects a platform-selecting loader and rewrites accepted methods. Native compilation is disabled by default. Unsupported methods are skipped by default; compiler failure leaves methods as JVM bytecode. Failure settings can instead stop the job. See native configuration and example for selection rules, toolchains and targets.
Implementation: Validator · C++ backend · Compiler · Native runner
Pipeline
flowchart LR
WorkResources --> JvmObfuscation
JvmObfuscation --> NativeObfuscation
NativeObfuscation --> FinalOutput
- Load input and dependencies. Input classes and resources form the output's working set. Library classes supply resolution and hierarchy information; dependency JARs are not copied into the output.
- Build the JVM pipeline. Enabled entries retain their configured order. The engine checks order rules and rejects invalid combinations. Adjacent parallel class operations are batched together; sequential operations and barriers synchronize work.
- Apply mappings and cooperating passes. Renamers collect mappings; the engine inserts
MappingApplierafter the last mapping-producing renamer.ReflectionSupportrecords recognized literals before transformations so mapping application can update them.RuntimeMaterialsupplies key material toReferenceObfuscate;PostProcessupdates supported resource entry points. - Run the optional native stage and write the JAR. Native compilation consumes the transformed classes. The writer includes generated classes/resources and applies archive settings.
Implementation: Engine · Parallel scheduling · Execution stages
Quick start
Requirements and build
Use JDK 25 to build and run this checkout. The universal desktop JAR packages Compose runtimes for Windows x64, Linux x64, macOS x64 and macOS arm64. Native output targets are configured separately.
Download the grunteon-ui-universal-jar artifact from a successful Grunteon CI run, or build from the repository root. Run the two commands separately so packaging consumes freshly built core JARs.
./gradlew :grunt-bootstrap:jar :grunt-index:jar :grunt-ir:jar :grunt-main:jar
./gradlew :grunt-ui:packageUniversalUberJar
Windows PowerShell:
.\gradlew.bat :grunt-bootstrap:jar :grunt-index:jar :grunt-ir:jar :grunt-main:jar
.\gradlew.bat :grunt-ui:packageUniversalUberJar
Output: grunt-ui/build/compose/jars/Grunteon-3.0.0-all.jar.
Desktop editor
Run from the directory containing the JAR:
java --enable-native-access=ALL-UNNAMED -jar Grunteon-3.0.0-all.jar
- In General, choose the input JAR, add dependencies under Libraries, and choose a separate output path.
- In Editor, add transformers, edit settings and arrange execution order. Start with the features you need; the default job has no transformers.
- Use Native if you want native compilation, then Save Config and Run Obfuscation. Check the log and test the output in its normal runtime or host application.
Command line
The same JAR contains the CLI. Place input.jar beside it and save this example as config.json. It encrypts numeric/string constants and runs resource post-processing. Add actual dependency paths to libs when needed.
{
"globalConfig": {
"input": "input.jar",
"output": "output.jar",
"libs": []
},
"transformers": [
{
"config": {
"type": "net.spartanb312.grunteon.obfuscator.process.transformers.encrypt.number.NumberBasicEncrypt.Config"
}
},
{
"config": {
"type": "net.spartanb312.grunteon.obfuscator.process.transformers.encrypt.string.StringArrayedEncrypt.Config"
}
},
{
"config": {
"type": "net.spartanb312.grunteon.obfuscator.process.transformers.PostProcess.Config"
}
}
]
}
java --enable-native-access=ALL-UNNAMED -cp Grunteon-3.0.0-all.jar net.spartanb312.grunteon.obfuscator.MainKt --config config.json
--config <path> and --config=<path> are supported; the default is config.json. Relative paths resolve from the process working directory. For a larger job, save its configuration in the editor and pass that JSON to the CLI. See configuration and order rules before combining more passes.
Extensions
| Plugin | Transformers | Scope |
|---|---|---|
| Yapyap | NumberSPECKEncrypt, NumberAttributeBasedEncrypt, StringAttributeBasedEncrypt |
SPECK numeric encryption and attribute-based numeric/string pools with generated runtime helpers. |
| GLSL | GlslObfuscator |
Process shader resources: resolve includes, rename locals/parameters/private functions and inline eligible functions. Marked as developing. |
Build the plugin JARs separately:
./gradlew :grunt-yapyap:jar :grunt-glsl:jar
.\gradlew.bat :grunt-yapyap:jar :grunt-glsl:jar
Copy the desired JARs from each module's build/libs/ into plugins/ under the application's working directory, then restart. Discovery validates manifest metadata, API version and dependencies before registering transformers. Plugins must load before a configuration referencing their types is parsed. These plugin implementations are not bundled in the core UI JAR.
For custom extensions, start with GruntPlugin, PluginContext and the GLSL entry.
Repository structure
| Module | Responsibility | Entry point |
|---|---|---|
grunt-main |
Engine, configuration, transformers, hierarchy analysis and native pipeline | Grunteon.kt |
grunt-ir |
Flow/SSA IR, JVM import/export, verifiers and IR tooling | Module build |
grunt-index |
Class/member metadata indexing and .gi serialization |
Index entry |
grunt-bootstrap |
Bootstrap and external class loading used by plugins | ExternalClassLoader |
grunt-ui |
Compose Fluent desktop application and configuration editor | App.kt |
grunt-backend |
Spring Boot HTTP API, Redis queue, separate JVM workers and result downloads | Backend guide |
grunt-yapyap |
Optional encryption extension pack | Yapyap.kt |
grunt-glsl |
Shader parsing, analysis, renaming and inlining | GlslProcessor.kt |
grunt-testcase |
Java fixtures used by transformer tests | Module build |
Development status
ControlflowFlatteningSSAis hidden from the normal transformer list and marked Experimental. Flow/SSA round-trip passes are diagnostic tools.NativePreProcessor,NativeCandidateandGlslObfuscatorare marked Developing in source. Native support is validated per method; selecting a candidate does not guarantee conversion.Cppis the implemented native backend.Llvmis a reserved configuration value and is not implemented.- Constant-pool extraction and HardwareID authentication remain unfinished items from the project roadmap.
Transformation choices affect size, runtime cost and compatibility. Reflection support handles recognized literals, not arbitrary computed names. EnumOptimize removes the array clone in values(); StringEqualsOptimize substitutes hash comparisons. These passes have observable semantic tradeoffs, documented alongside their settings in the guide.
Documentation
Each language has one complete user guide covering setup, configuration syntax, all transformer settings, the native pipeline, plugins, desktop preferences, the backend and troubleshooting.
| Language | README | User guide |
|---|---|---|
| English | README | User guide |
| 正體中文 | README | 使用者手冊 |
| 简体中文 | README | 用户手册 |
| Deutsch | README | Benutzerhandbuch |
| Русский | README | Руководство пользователя |
| 日本語 | README | ユーザーガイド |
Start here: Global settings · Filters · Dictionaries · Native configuration · Troubleshooting.
Community
Questions and suggestions: Discord or QQ group 554702632. Report reproducible issues through GitHub Issues, with the relevant configuration, log and a minimal input when possible.
License
| Component | License | License text |
|---|---|---|
| Core repository | Apache License 2.0 | LICENSE.md |
| Yapyap extension | PolyForm Strict License 1.0.0 | Yapyap license |
| Native-code implementation | PolyForm Strict License 1.0.0 | Native-code license |
Stargazers over time
Explore projetos relacionados
Carregando…