Skip to main content

AI-powered code obfuscation utility

Project description

obfuscator-ai

Interactive code obfuscation tool with AI-powered pattern recognition. Protect sensitive information in your code by replacing identifiable elements with secure placeholders.

Features

  • Interactive GUI - Click any word to instantly obfuscate it
  • Pattern Recognition - Automatically detect and obfuscate similar patterns
  • Smart Detection - Auto-identifies emails, IPs, GUIDs, paths, and namespaces
  • Reversible - Full deobfuscation with preserved mappings
  • Multiple Modes - Exact word matching or pattern-based obfuscation
  • Persistent Mappings - Reuse obfuscation mappings across sessions

Installation

pip install obfuscator-ai

Usage

Basic Usage

  1. Copy your code to clipboard
  2. Run the obfuscator:
from obfuscator_ai import SecureObfuscator
import pyperclip

obf = SecureObfuscator()
obf.run_interactive(pyperclip.paste())

Or run directly:

python -m obfuscator_ai

GUI Controls

  • Click any word - Obfuscate all instances
  • Mode Toggle - Switch between exact and pattern matching
  • Pattern Buttons:
    • GUIDs - Obfuscate all GUID patterns
    • Methods - Obfuscate C# method names
    • Lambda Props - Obfuscate lambda properties
    • All Strings - Obfuscate all string literals
  • UNDO - Revert last action (Ctrl+Z)
  • Show Mappings - View all obfuscation mappings
  • Deobfuscate All - Restore original text and close
  • Close & Copy - Copy obfuscated text to clipboard

Placeholder Types

The tool uses different prefixes for different content types:

  • SENSITIVE### - Sensitive words from config
  • URL### - Web URLs
  • STRING### - String literals
  • ANONYMIZED### - User-selected words
  • PATTERN### - Pattern-matched content
  • GUID### - GUID identifiers
  • EMAIL### - Email addresses
  • IP### - IP addresses
  • PATH### - File paths
  • NAMESPACE### - Code namespaces
  • METHOD### - Method names
  • LAMBDA_PROP### - Lambda properties

Configuration

Create config.json in your working directory:

{
  "sensitive_words": ["password", "apikey", "secret"],
  "rules": [
    {
      "pattern": "\\b[A-Z]{3}\\d{4}\\b",
      "prefix": "ID",
      "whole_match": true
    }
  ]
}

Examples

Before Obfuscation

public class UserService {
    private string apiKey = "sk-1234567890";
    
    public User GetUser(string email) {
        var user = db.Users.FirstOrDefault(u => u.Email == email);
        logger.LogInformation($"Retrieved user: {email}");
        return user;
    }
}

After Obfuscation

public class CLASS1 {
    private string STRING1 = "STRING2";
    
    public CLASS2 METHOD1(string ANONYMIZED1) {
        var ANONYMIZED2 = ANONYMIZED3.CLASS3.METHOD2(LAMBDA_PROP1 => LAMBDA_PROP1.ANONYMIZED1 == ANONYMIZED1);
        METHOD3.METHOD4($"LOG_CONTENT1");
        return ANONYMIZED2;
    }
}

Mappings

Mappings are saved to mapping.json and persist between sessions. This allows you to:

  • Maintain consistent obfuscation across multiple files
  • Share obfuscated code while keeping mappings secure
  • Deobfuscate at any time with the original mappings

Security Notes

  • Mappings file contains sensitive data - keep it secure
  • Don't commit mapping files to version control
  • Use different mappings for different security contexts
  • The tool is for protecting sensitive information, not encryption

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obfuscator_ai-0.1.5.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obfuscator_ai-0.1.5-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file obfuscator_ai-0.1.5.tar.gz.

File metadata

  • Download URL: obfuscator_ai-0.1.5.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for obfuscator_ai-0.1.5.tar.gz
Algorithm Hash digest
SHA256 d6a1aa97799bd1fbe2bd488b55b0268dc6643769d5116b22492124632d9f30a7
MD5 4350384f3f0d8b640a35a35472f22258
BLAKE2b-256 763318b9af9504e31a8e9ad94b52a38a8db0eabcc05197053f5bb95a9595d5e8

See more details on using hashes here.

File details

Details for the file obfuscator_ai-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: obfuscator_ai-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for obfuscator_ai-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a059f9044144304e35402ec3883237b603abce06dff30fc3e1517843cadb37d9
MD5 9537c13084e9acdbf6f37e1517825c79
BLAKE2b-256 2d20ef630a62b296c47cb6da6e7be50c8c06da4fba4418483f177c6a53bc2801

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page