语言与混淆等级
| 语言 | 等级 | 说明 |
| JavaScript | light / standard(默认) / max | 参考 js-obfuscator 在线预设:轻 = 压缩与十六进制标识符;中 = 字符串加密 + 控制流扁平化;高 = 全量混淆(性能开销大) |
| Python | light(轻) / high(默认) | 轻 = 仅压缩打包(zlib + base64 自解压外壳,源码不改写,兼容性最好);高 = 词法混淆(重命名 / 字符串加密 / 数字混淆)+ 多层自解压外壳 |
| Shell | base64(默认) / high | 默认 = base64 经 base64 -d | bash 执行;高 = bashfuscator 风格多层变换(base64 + 字符替换 + 八进制 printf + 变量拼接) |
Shell 兼容旧等级值:light/standard → base64,max → high。Python 兼容旧等级值:standard/max → high。
认证与限流
调用混淆接口时携带 X-API-Key 请求头。没有 Key 时按 IP 匿名限流(10 次/分钟)。
| 调用方式 | 每分钟 | 每日 |
| 匿名(无 Key) | 10 次 | — |
| API Key | 100 次 | 5,000 次 |
超限时返回 429 与 Retry-After 响应头;所有错误都返回统一结构 { success, requestId, error: { code, message } }。
POST /api/v1/obfuscate
混淆一段源代码。Body 为 JSON:language(javascript | python | shell)、code(1 ~ 200KB)、level(可选,见上表)、options(可选,仅 JavaScript 生效的高级开关)。
curl -X POST https://obf.8818618.xyz/api/v1/obfuscate \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"language": "javascript",
"level": "standard",
"code": "function hello() { console.log(\"hi\"); }"
}'const res = await fetch("https://obf.8818618.xyz/api/v1/obfuscate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": process.env.MTEACHER_OBF_KEY,
},
body: JSON.stringify({
language: "shell", // javascript | python | shell
level: "high", // 见「语言与等级」
code: 'echo "hello"',
}),
});
const { data } = await res.json();
console.log(data.code); // 混淆结果
console.log(data.stats); // { originalSize, outputSize, ratio, duration }import os
import requests
resp = requests.post(
"https://obf.8818618.xyz/api/v1/obfuscate",
headers={"X-API-Key": os.environ["MTEACHER_OBF_KEY"]},
json={
"language": "python", # level 可选:light 仅压缩 / high 词法混淆(默认)
"code": "def greet(name):\n print(f'hello {name}')\n",
},
)
payload = resp.json()
print(payload["data"]["code"])
print(payload["data"]["stats"]["duration"], "ms")
成功响应:{ "success": true, "requestId": "…", "data": { "code": "…", "stats": { "originalSize": 1024, "outputSize": 2048, "ratio": 2.0, "duration": 37 } } }
POST /api/v1/keys
用邮箱换取 API Key(每分钟最多 5 次)。同一邮箱重复调用返回同一个 Key。
curl -X POST https://obf.8818618.xyz/api/v1/keys \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com"}'
# → { "success": true, "data": { "key": "mt_…", "dailyQuota": 5000, "perMinute": 100 } }
GET /api/v1/keys/me
查询当前 Key 的用量:今日 / 累计调用次数、剩余配额。
curl https://obf.8818618.xyz/api/v1/keys/me \
-H "X-API-Key: YOUR_API_KEY"
健康检查与元信息
GET /api/v1/health 返回服务状态与版本;GET /api/v1/languages 返回支持的语言、各语言的等级与默认值。
获取我的 API Key
输入邮箱即刻生成,无需注册。请妥善保管,Key 即身份。