XTC V3 API Encryption/Decryption utilities
Project description
xtcv3utils
XTC V3 API 加密/解密工具
V3 API encryption/decryption utilities (protocol implementation for XTC services).
安装 / Install
pip install xtcv3utils
需要依赖 pycryptodome。
快速开始 / Quick Start
from xtcv3utils import V3Client
client = V3Client(
aes_key="your-aes-key",
eebbk_key="rsa-encrypted-eebbk-key",
key_id="your-key-id",
watch_id="your-watch-id",
device_id="bind-number",
token="chip-id",
mac="mac-address",
)
# 加密请求
headers, encrypted_body = client.encrypt_request(
url="https://api.example.com/moment/public",
body='{"watchId":"your-watch-id","content":"hello","type":3}',
)
# 解密响应
plain_text = client.decrypt_response(
response_body=response_text,
is_encrypted=True,
)
API
V3Client
| 方法 | 说明 |
|---|---|
encrypt_request(url, body, extra_headers) |
加密完整请求,返回 (headers, encrypted_body) |
decrypt_response(response_body, is_encrypted) |
解密服务器响应 |
build_base_param_json() |
构建基础参数 JSON(deviceId, token, timestamp 等) |
generate_sign(url, base_param_json, body) |
计算 Eebbk-Sign |
create_client_from_decrypted_keys(key_str, ...)
从 "keyId:aesKey:eebbkKey" 格式的密钥字符串直接创建客户端。
V3 加密原理
| 步骤 | 算法 | 用途 |
|---|---|---|
| 密钥传输 | RSA/ECB/PKCS1Padding | 安全分发 AES 密钥 |
| 参数加密 | AES/ECB/PKCS5Padding | 加密设备信息 (Base-Request-Param) |
| Body 加密 | GZip → AES/ECB/PKCS5Padding → Base64 | 压缩并加密请求体 |
| 签名 | MD5(url + baseParam + body + aesKey) |
请求完整性校验 |
| 响应解密 | AES 解密 → GZip 解压 | 读取加密响应 |
签名使用的 URL 不包含 ?uuid=xxx 参数(uuid 在签名完成后才追加)。
相关项目
- Frida hook 脚本 — 运行时提取 AES 密钥
- 加密请求脚本 — 命令行加密并生成 curl 命令
- HttpCanary 解密脚本 — 解密抓包文件
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xtcv3utils-1.1.0.tar.gz
(10.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xtcv3utils-1.1.0.tar.gz.
File metadata
- Download URL: xtcv3utils-1.1.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e20fc3d2a9339c517e879fc859041550c1298d48a3ba74c8df8ac92dad9b565
|
|
| MD5 |
4c3c5863ae1f369046af85c299a65b87
|
|
| BLAKE2b-256 |
10f5cf7e8736ad01035c5536e5c01be369277cb5c4f897e6de0781f132970a10
|
File details
Details for the file xtcv3utils-1.1.0-py3-none-any.whl.
File metadata
- Download URL: xtcv3utils-1.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6890b82e64d64e64437e302bef1a698b854e3af92a73cb01391708ff0ca31e26
|
|
| MD5 |
86dd90a2e841b154c08351ecb2c99999
|
|
| BLAKE2b-256 |
69287bc234a843a4892ba49374b4f281d3f24e8b0bd46c9250e7b28f99ee7262
|