Files
puddy 9873eb1963 restore: 恢复 11-06~11-09 本地未提交改动
- libs: 新增 hr_sdk / hotel_report / dingtalk,更新 desktopauto
- controlplane-next: SDK 管理模块(controller/entity/migrations)与前端视图
- electron-shell: 插件同步、注册表、runner 调整
- plugins: XQ0035/XQ0041/XQ0042/XQ0045_XQ0046/XQ0048/XQ0076/XQ0078 等版本更新
- tests/tools: 新增 SDK 兼容性检查与打包工具(sdk_pack.py、sdk_compat_check.py)
2026-11-09 17:27:10 +08:00

41 lines
1.4 KiB
Python

"""临时:从已抓到的 packets.jsonl 里提取导出链路报文(紧凑版,用完即删)。"""
import json
import os
import sys
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "capture", "20261106-093603")
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "_dump_export.txt")
WANT = ("exportNew", "download/polling", "download/downLoadList", "download/look",
"download/read", "download/downLoad/")
seen = {}
order = []
for raw in open(os.path.join(ROOT, "packets.jsonl"), encoding="utf-8"):
rec = json.loads(raw)
path = rec["path"]
if not any(k in path for k in WANT):
continue
key = (rec["method"], path if "download" not in path else path.split("/read/")[0].split("/downLoad/")[0])
if key in seen:
continue
seen[key] = rec
order.append(key)
lines = []
for key in order:
rec = seen[key]
lines.append("-" * 90)
lines.append(f"{rec['method']} {rec['url']}")
lines.append(f" POST: {(rec['postData'] or '')[:900]}")
body = rec.get("body") or ""
lines.append(f" RESP({rec['size']}B) ct={rec['contentType']} bin={rec['binaryFile']}")
lines.append(f" {body[:900]}")
text = "\n".join(lines)
with open(OUT, "w", encoding="utf-8") as f:
f.write(text)
print(f"wrote {len(text)} chars, {len(order)} unique")