🦀 rustfuscator
Note:
The publication on crates.io will be restored soon.
It was temporarily taken down due to some conflicts, but it will be resolved and republished shortly.
In the meantime, you can install it directly from the GitHub repository by following the instructions below.
Obfuscation-first CLI and library for Rust.
Protect your source code from reverse engineering by encrypting string literals, injecting opaque control-flow, and rewriting AST logic — with full automation CLI, macros or a derive.
Features
- Full CLI: obfuscate files, folders, or full Cargo projects
- Configurable via
.obfuscate.toml
- Output formatting (
--format
) - No runtime dependency or unpacking
- Obfuscate string literals at compile-time (
obfuscate_string!
) - Insert control-flow breaking statements (
obfuscate_flow!
) - Derive macro for struct encryption (
#[derive(Obfuscate)]
)
Installation
Once published:
cargo install rustfuscator
Or clone and build:
git clone https://github.com/GianIac/rustfuscator
cd rustfuscator
cargo install --path obfuscator_cli
Command-Line Interface
The CLI is the most powerful part of rustfuscator. You can obfuscate anything from a single file to a full Rust project.
Obfuscate a single file
rustfuscator --input ./src/main.rs --output ./obf
Obfuscate a full source folder
rustfuscator --input ./src --output ./obf_src
Obfuscate an entire Cargo project
rustfuscator \ --input ./my_project \ --output ./my_project_obf \ --as-project \ --format
Automatically:
- Copies your project structure
- Patches Cargo.toml
- Applies macro-based obfuscation
- Optionally formats the output
Configuration with .obfuscate.toml
Generate a default config:
rustfuscator --input ./my_project --init
Example file:
Library Usage
Add to your Cargo.toml:
[dependencies] --> rust_code_obfuscator = "0.2.1"
Use it:
Derive Struct Encryption
Project Layout
Disclaimer
Obfuscation does not guarantee complete protection. It significantly increases the complexity of reverse engineering, but should be combined with:
- Binary stripping
- Anti-debugging
- Compiler flags
- Other hardening strategies
License
MIT License © 2025 Gianfranco Iaculo