/GoBfuscator

Primary LanguagePythonMIT LicenseMIT

๐Ÿ›ก๏ธ GoBfuscator - Advanced Go Code Obfuscation Tool

Go Version License GitHub Stars GitHub Forks

GoBfuscator - obfuscate go scripts

๐Ÿ” Overview

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

๐Ÿš€ Quick Start

Installation

git clone https://github.com/luftwaffe66/GoBfuscator.git
cd GoBfuscator
pip install -r requirements.txt

Basic Usage

python3 obfuscator.py yourfile.go

This will generate yourfile_obfuscated.go with all protections applied.

๐Ÿ› ๏ธ Technical Implementation

Multi-Layer Obfuscation

  1. 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
  2. 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
  3. Code Cleanup:

    • Removal of all comments
    • Compression of whitespace
    • Normalization of formatting

Security Features

  • ๐Ÿ”‘ Unique encryption key generated per run
  • ๐Ÿ›ก๏ธ Protection against simple string extraction tools
  • ๐Ÿ”„ Randomized naming prevents pattern recognition
  • โš ๏ธ Preserves important escape sequences (\n, \t, etc.)

๐Ÿ“Š Benchmark Results

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

๐Ÿงฉ Integration

CI/CD Pipeline

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

Advanced Options

# Preserve specific identifiers
python3 obfuscator.py --preserve "Config,DBConn" main.go

# Custom encryption key (base64)
python3 obfuscator.py --key "dGhpcyBpcyBhIHNlY3JldCBrZXkh" main.go

๐Ÿ“š Documentation

How It Works

  1. Parsing Phase:

    • Extracts all renameable identifiers
    • Identifies strings for encryption
    • Preserves code structure
  2. Transformation Phase:

    • Generates random names for identifiers
    • Encrypts strings with AES-256
    • Builds decryption infrastructure
  3. Output Phase:

    • Generates clean, functional Go code
    • Adds required decryption functions
    • Maintains original functionality

Limitations

  • โŒ Doesn't handle reflection-based code analysis
  • โŒ Can't obfuscate exported package names
  • โŒ May break some debugger functionality

๐Ÿค Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“œ License

Distributed under the MIT License. See LICENSE for more information.

๐Ÿ“ฌ Contact

Project Maintainer - @luftwaffe66

๐ŸŒŸ Acknowledgments

  • 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.