GoBfuscator is a professional-grade obfuscation tool specifically designed for Go (Golang) source code. It provides multiple layers of protection to make reverse engineering difficult while maintaining 100% runtime functionality.
Key Features:
- ✨ AES-256 encrypted strings with runtime decryption
- 🔀 Comprehensive identifier renaming (functions, variables, types)
- 🧹 Code cleanup and comment removal
- 🛡️ Protection against common reverse engineering techniques
- ⚡ Zero runtime performance overhead after initial decryption
git clone https://github.com/luftwaffe66/GoBfuscator.git
cd GoBfuscator
pip install -r requirements.txtpython3 obfuscator.py yourfile.goThis will generate yourfile_obfuscated.go with all protections applied.
-
Identifier Renaming:
- All non-reserved identifiers are replaced with random 6-character names
- Preserves Go reserved words and standard library imports
- Handles method receivers and package-level declarations
-
String Encryption:
- Uses AES-256-CBC with random IV for each string
- Base64 encoded for embedding in source
- Runtime decryption with automatic PKCS7 padding removal
-
Code Cleanup:
- Removal of all comments
- Compression of whitespace
- Normalization of formatting
- 🔑 Unique encryption key generated per run
- 🛡️ Protection against simple string extraction tools
- 🔄 Randomized naming prevents pattern recognition
⚠️ Preserves important escape sequences (\n, \t, etc.)
| Operation | Original | Obfuscated | Overhead |
|---|---|---|---|
| Startup Time | 12ms | 15ms | +25% |
| Memory Usage | 8.2MB | 8.5MB | +3.6% |
| Runtime Performance | 1.0x | 1.0x | 0% |
Tests performed on Go 1.19, Intel i7-1185G7, 16GB RAM
steps:
- name: Obfuscate Go Code
run: |
git clone https://github.com/luftwaffe66/GoBfuscator.git
cd GoBfuscator
python3 obfuscator.py $GITHUB_WORKSPACE/main.go
mv main_obfuscated.go $GITHUB_WORKSPACE/main.go# Preserve specific identifiers
python3 obfuscator.py --preserve "Config,DBConn" main.go
# Custom encryption key (base64)
python3 obfuscator.py --key "dGhpcyBpcyBhIHNlY3JldCBrZXkh" main.go-
Parsing Phase:
- Extracts all renameable identifiers
- Identifies strings for encryption
- Preserves code structure
-
Transformation Phase:
- Generates random names for identifiers
- Encrypts strings with AES-256
- Builds decryption infrastructure
-
Output Phase:
- Generates clean, functional Go code
- Adds required decryption functions
- Maintains original functionality
- ❌ Doesn't handle reflection-based code analysis
- ❌ Can't obfuscate exported package names
- ❌ May break some debugger functionality
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Project Maintainer - @luftwaffe66
- Inspired by various open-source obfuscation tools
- Uses PyCryptodome for AES implementation
- Thanks to all contributors and users
🔐 Protect Your Go Code Today! Star this repo to support the project.
