gtkobf1 1.0
A powerful python obfuscator
License: MIT

  

# GTKFuscator


## 🛡️ Python Code Obfuscator

GTKFUSCATOR is a simple yet effective Python script designed to obfuscate your .py source code into a highly protected, self-contained executable file. It uses a multi-layered pipeline of serialization, compression, encryption, and encoding to make reverse engineering significantly more challenging.

## ✨ Features

The obfuscation process involves several distinct layers to protect the original source code:

Bytecode Serialization (Marshal): The source code is first compiled and serialized into Python bytecode using the marshal module.

Compression (Zlib): The bytecode is compressed using zlib to reduce file size and further obscure the original data.

XOR Encryption: The compressed blob is encrypted with a single-byte XOR key, which is randomly generated for each obfuscation run.

Multi-layer Base64 Encoding: The data is encoded using two layers of Base64, providing a wrapper around the encrypted and compressed data.

Anti-Tamper Checksum: A SHA256 checksum is generated for the final encoded string. The built-in loader checks this hash on execution. If the obfuscated file is modified, the loader prints an error and exits, preventing execution.

Random Junk/Filler: The output file includes randomly generated junk comments using non-standard Unicode characters to increase file variance and confuse static analysis tools.

Dynamic Loader: The resulting script is a lightweight Python loader with random variable names that reconstructs the original bytecode in memory and executes it using exec().

## ⚙️ How to Use

Prerequisites

Python 3.x (Standard library modules are used, no external packages needed).

Running the Obfuscator

```bash
git clone https://github.com/gtk-gg/GTKFuscator
cd GTKFuscator
```

Run the script from your terminal:

```bash
python obfuscator.py
```

The script will prompt you for the path to the Python file you wish to obfuscate:

Enter path to Python script: ```C:\Users\YourUsername\Desktop\Project\my_script.py``` (Example)


## Output

The script will generate a new file named after the input file, appended with ```_obf.py```
If the input was ```my_script.py```, the output will be ```my_script_obf.py```.

You can now distribute or run the obfuscated file directly:

```python my_script_obf.py```


The obfuscated script contains the secure loader and the encrypted payload, and it will execute the original code if the anti-tamper check passes.

## ⚠️ Important Warning

**GTKFUSCATOR is designed for educational purposes and for protecting proprietary code owned by you. You are responsible for any code you obfuscate.**

* **Do not use this tool on files you do not own.** Using this or any similar tool to modify or hide malicious code, or to circumvent license agreements, is strictly forbidden and may violate laws and terms of service.
* **Always test the output:** Due to the nature of compilation and execution, heavily modified or complex scripts might occasionally fail after obfuscation. Always test the resulting `_obf.py` file to ensure it functions as expected.
* **This is not 100% encryption:** Obfuscation is a deterrence measure, not true encryption. Skilled reverse engineers can still decompile Python bytecode. Always assume that your code can eventually be inspected. Obfuscation is not a foolproof
*  **Responsible Use:** DO NOT use this tool to hide, obscure, or distribute malicious code, malware, or viruses. Any use in violation of this directive is strictly forbidden. This script is intended strictly for educational purposes and for protecting proprietary code you own.