Metadata-Version: 2.4
Name: jh_pyenc
Version: 0.0.5
Summary: jh_pyenc - Python代码 加密? 处理工具 / Python Code (encryption?) Processing Tool
Author: JiJiahui
Author-email: tn-jh@foxmail.com
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=3.4.7
Requires-Dist: cython>=0.29
Requires-Dist: setuptools>=45
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# jh_pyenc - Python代码 加密? 处理工具 / Python Code (encryption?) Processing Tool

---

其实就是我嫌自己写的代码太丑，干脆一不做二不休，全给它糊成乱码，眼不见心不烦。小打小闹用用没问题，想逆回去也不是不行，就是得花点时间。要是想要正经加密？出门左拐，好走，拜了个拜～

This is basically for when I can't stand looking at my own code anymore, so I just nuke it into unreadable chaos. Works for small stuff — feel free to play around, and hey, you can reverse it if you try hard enough. But production-level encryption? Oh honey, take a left and don't let the door hit you on the way out, lol.


## 安装 / Installation
```bash
pip install jh_pyenc
```

## 依赖 / Dependencies
- cryptography, cython, setuptools
- C compiler / C编译器 (Visual Studio Build Tools / Xcode CLT / build-essential)

## 快速开始 / Quick Start
```bash
jh_pyenc ./myproject -p "my_password"
```

## 命令 / Commands
```bash
jh_pyenc <directory> [options]
```

### 选项 / Options
| Option | 说明 / Description                       |
|--------|----------------------------------------|
| `-p, --password` | 密码 / Password |
| `--whl` | 打包运行时为whl / Package runtime as .whl    |
| `--no-backup` | 不备份原文件 / Skip backup                   |

### 安全选项 / Security Options
| Option | 说明 / Description                                         |
|--------|----------------------------------------------------------|
| `--expire DATE` | 过期日期 / Expiration date YYYY-MM-DD                        |
| `--mac MAC` | 绑定MAC(可多次) / Bind MAC address (repeatable)               |
| `--remote URL` | 远程验证地址 / Remote validation endpoint                      |
| `--anti-debug` | 启用反调试(请注意这个功能有问题) / Enable anti-debugging (not use)      |
| `--junk` | 启用垃圾代码 / Enable junk code injection                      |
| `--debug-threshold N` | 反调试时间阈值 / Anti-debug threshold in seconds (default: 0.3) |
| `--trap MODE` | 陷阱模式 / Trap mode: random/exit/hang/error/silent          |
| `--env-bind` | 启用环境绑定 / Enable environment binding                      |

### 远程验证服务端示例 / Remote Validation Server
```python
from http.server import HTTPServer, BaseHTTPRequestHandler
import json

AUTHORIZED = {"ff:ff:ff:ff:ff:ff"}

class Handler(BaseHTTPRequestHandler):
    def do_POST(self):
        length = int(self.headers['Content-Length'])
        data = json.loads(self.rfile.read(length))
        machine = data.get('machine', '')
        valid = machine in AUTHORIZED
        self.send_response(200)
        self.send_header('Content-Type', 'application/json')
        self.end_headers()
        self.wfile.write(json.dumps({'valid': valid}).encode())

HTTPServer(('0.0.0.0', 5000), Handler).serve_forever()
```

## 示例 / Examples
```bash
# 基础 / Basic
jh_pyenc ./myproject -p "secret"

# 带过期 / With expiration
jh_pyenc ./myproject -p "secret" --expire 2026-12-31

# MAC绑定 / MAC binding
jh_pyenc ./myproject -p "secret" --mac ff:ff:ff:ff:ff:ff

# 打包whl / Package as wheel
jh_pyenc ./myproject -p "secret" --whl

# 全量保护 / Full protection
jh_pyenc ./myproject -p "secret" --anti-debug --junk --trap exit

# 远程验证 / Remote validation
jh_pyenc ./myproject -p "secret" --remote https://api.example.com/verify
```

## 注意事项 / Notes
- 请妥善保管密码 / Keep your password safe
- 原文件自动备份到 `xxx_bak/` / Originals backed up to `xxx_bak/`
- 处理后需要pyruntime才能运行 / pyruntime required to run processed files
- 本工具为混淆处理，无法达到生产级安全标准 / This is an obfuscation tool, not production-grade security
- 请为自己的行为负责哦亲 / Please take responsibility for your actions, dear.
```
