WorkbenchCrypto

A simple Python tool for encrypting and decrypting MySQL Workbench's workbench_user_data.dat file using the Windows Data Protection API (DPAPI).


Features

  • Decrypt workbench_user_data.dat: Convert the encrypted MySQL Workbench connection file into a human-readable format.
  • Encrypt workbench_user_data.dat: Convert the human-readable format back into a secure, encrypted file for use in MySQL Workbench.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/WorkbenchCrypto.git
    cd WorkbenchCrypto
  2. Install dependencies:

    pip install -r requirements.txt

Usage

Run the script to encrypt or decrypt the workbench_user_data.dat file:

python main.py

Example

  1. Decrypt the workbench_user_data.dat File

    • Select d for decryption when prompted.
    • Confirm or specify the input and output file paths.
    • Default:
      • Input: workbench_user_data.dat
      • Output: workbench_user_data_decrypted.txt

    Important: Decryption must be performed on the same system and user account where the file was originally encrypted. This is because DPAPI ties the encryption to the specific Windows user and machine.

    Output:

    Decryption successful. Decrypted data saved to: workbench_user_data_decrypted.txt
    
  2. Encrypt the workbench_user_data.dat File

    • Select e for encryption when prompted.
    • Confirm or specify the input and output file paths.
    • Default:
      • Input: workbench_user_data_decrypted.txt
      • Output: workbench_user_data.dat

    Note: Encryption is currently in beta and has not been tested in several scenarios. Use with caution and verify the results before relying on them in production environments.

    Output:

    Encryption successful. Encrypted data saved to: workbench_user_data.dat
    

Default File Paths

Mode Input File Output File
Encrypt workbench_user_data_decrypted.txt workbench_user_data.dat
Decrypt workbench_user_data.dat workbench_user_data_decrypted.txt

You can override these paths when prompted.


Requirements

  • Windows OS: The tool relies on the Windows Data Protection API (DPAPI).
  • Python 3.x
  • pywin32 library: Install it via pip.

Install dependencies:

pip install -r requirements.txt

Notes

  • Windows-Only: This tool uses DPAPI, which is exclusive to Windows.
  • Handle with Care: The decrypted file contains sensitive credentials. Delete it securely after use.
  • Encryption Scope: Files encrypted with DPAPI are tied to the specific user account and machine.
  • System Dependency: Decryption must be performed on the original system and user account where the file was created.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Author

Sebin Benjamin