kaellexploitt/obfus
GitHub: kaellexploitt/obfus
一款零依赖的 Python 源代码混淆工具,通过变量重命名、垃圾代码注入、字符串编码和密码加密等手段保护 Python 脚本免遭源码窃取。
Stars: 0 | Forks: 0
```
██████╗ ██████╗ ███████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║██╔════╝
██║ ██║██████╔╝█████╗ ██║ ██║███████╗
██║ ██║██╔══██╗██╔══╝ ██║ ██║╚════██║
██████╔╝██████╔╝██║ ╚██████╔╝███████║
╚═════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝
```
# 🛡️ Python Obfuscator v2.0
**保护你的 Python 工具 — 加密,混淆,武装。**
作者:**[kael exploit](https://github.com/kaellexploitt)**



-orange?style=flat-square)
## 📌 关于
**obfus** 是一款用于保护你的源代码免遭盗窃的 Python 工具。
混淆后的文件**依然可以正常运行** —— 只是让别人难以阅读。
适用于:
- 想要分享但不想源码被盗的工具
- 隐藏 API key / 敏感逻辑
- 在 Termux / Linux 上保护自制的工具
## ✨ 功能
| 功能 | 说明 |
|---|---|
| 🔀 **Rename Scramble** | 将所有变量名和函数名替换为不可读的随机名称 |
| 🧩 **Junk Code Inject** | 插入虚假的 dummy 代码以增加逆向工程的难度 |
| 🔤 **String Encode** | 将所有字符串字面量编码为 Base64 |
| 🔐 **Compress & Wrap** | 压缩整个代码,然后将其包装在 `exec()` 中 |
| 🔐 **Password Encrypt** | 使用 PBKDF2 + HMAC-SHA256 + XOR-256 进行高强度加密 |
| 🔓 **Decrypt / Restore** | 只要拥有密码即可恢复至原始源码 |
| 🚫 **Zero Dependencies** | 纯 Python stdlib —— 无需任何 `pip install` |
| 📱 **Termux Ready** | 可在 Android 的 Termux 上流畅运行 |
## 🚀 安装说明
```
# Clone repo
git clone https://github.com/kaellexploitt/obfus.git
cd obfus
# 无需安装任何东西 — 直接使用
python obfus.py --help
```
### Termux
```
pkg update && pkg install python git
git clone https://github.com/kaellexploitt/obfus.git
cd obfus
python obfus.py --help
```
## 📖 使用方法
### 🔒 加密(混淆)
```
# Basic — Level 3(默认,最强)
python obfus.py enc tools.py
# 使用密码(最安全)
python obfus.py enc tools.py -pw
# 自定义 Level
python obfus.py enc tools.py -l 1 # Rename saja
python obfus.py enc tools.py -l 2 # + Junk + Encode string
python obfus.py enc tools.py -l 3 # + Compress + Exec wrap
# 自定义 Output
python obfus.py enc tools.py -o protected.py
# 组合
python obfus.py enc tools.py -l 2 -pw -o tools_protected.py
```
### 🔓 解密(恢复)
```
# 无密码
python obfus.py dec tools_obf.py
# 使用密码
python obfus.py dec tools_obf.py -pw
# 自定义 Output
python obfus.py dec tools_obf.py -o tools_restored.py
```
### ▶️ 运行混淆后的文件
生成的文件依然可以直接运行:
```
python tools_obf.py [argumen seperti biasa]
```
如果使用了密码,在运行前会先要求输入密码:
```
[🔑] Password: ****
```
## 🔢 保护级别
| 级别 | 执行操作 | 保护强度 |
|---|---|---|
| **-l 1** | 移除注释 + 重命名变量和函数 | ⭐⭐ |
| **-l 2** | + 注入 junk code + 编码 Base64 字符串 | ⭐⭐⭐ |
| **-l 3** | + zlib 压缩 + 包装 exec() *(默认)* | ⭐⭐⭐⭐ |
| **-l 3 -pw** | + PBKDF2 + HMAC-SHA256 加密 | ⭐⭐⭐⭐⭐ |
## 🔐 加密安全性(-pw 模式)
```
Password → PBKDF2-HMAC-SHA256 (300.000 iterasi) → 256-bit Key
→ Salt 16 byte (random)
→ Nonce 16 byte (random)
→ XOR-256 Stream Cipher
→ HMAC-SHA256 Integrity Check
→ zlib compress
→ Base64 encode
→ Magic Header: KAEL_OBFS_V2
```
- 每次加密都会生成不同的输出(随机 salt + nonce)
- 密码错误 → 直接拒绝执行(HMAC 验证失败)
- 没有后门 / master key
## 📁 文件结构
```
obfus/
├── obfus.py # Tool utama
├── README.md # Dokumentasi ini
├── LICENSE # MIT License
├── .gitignore # Git ignore
└── examples/
├── demo.py # Contoh file sebelum obfuscation
└── demo_obf.py # Contoh file sesudah obfuscation
```
## 💡 输出示例
**之前:**
```
import os, sys
SECRET_API = "sk-abc123xyz"
def get_user_data(user_id, token):
headers = {"Authorization": f"Bearer {token}"}
result = fetch_data(user_id, headers)
return result
def main():
if len(sys.argv) < 2:
print("Usage: python tool.py
⭐ **如果觉得有用,请给本 repo 加星!** ⭐
标签:DNS 反向解析, meg, Python, SOC Prime, 代码混淆, 信息安全, 开发工具, 无后门, 源码保护, 逆向工具