- 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)
61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
"""临时探针:抓前端 JS bundle,定位登录密码加密实现与请求字段(用完即删)。"""
|
|
import os
|
|
import re
|
|
import ssl
|
|
import sys
|
|
|
|
import requests
|
|
from requests.adapters import HTTPAdapter
|
|
|
|
if hasattr(sys.stdout, "reconfigure"):
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
BASE = "https://mch-web.tianquetech.com"
|
|
OUT = os.path.join(os.environ.get("TEMP", "."), "tianque_js")
|
|
|
|
|
|
class Low(HTTPAdapter):
|
|
def init_poolmanager(self, *a, **kw):
|
|
ctx = ssl.create_default_context()
|
|
ctx.set_ciphers("DEFAULT@SECLEVEL=0")
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
kw["ssl_context"] = ctx
|
|
return super().init_poolmanager(*a, **kw)
|
|
|
|
|
|
s = requests.Session()
|
|
s.mount("https://", Low())
|
|
s.headers.update({"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0 Safari/537.36"})
|
|
os.makedirs(OUT, exist_ok=True)
|
|
|
|
r = s.get(BASE + "/login", timeout=30)
|
|
print("login page", r.status_code, len(r.text))
|
|
open(os.path.join(OUT, "login.html"), "w", encoding="utf-8").write(r.text)
|
|
|
|
srcs = re.findall(r'<script[^>]+src="([^"]+)"', r.text)
|
|
print("scripts:", len(srcs))
|
|
hits = []
|
|
for src in srcs:
|
|
url = src if src.startswith("http") else BASE + ("" if src.startswith("/") else "/") + src
|
|
try:
|
|
resp = s.get(url, timeout=30)
|
|
except Exception as exc:
|
|
print("skip", url, exc)
|
|
continue
|
|
name = os.path.basename(url.split("?")[0])
|
|
path = os.path.join(OUT, name)
|
|
open(path, "w", encoding="utf-8", errors="replace").write(resp.text)
|
|
print(f" {name} {resp.status_code} {len(resp.text)}")
|
|
for kw in ("loginPwd", "loginByAccount", "abcdefgabcdefg12", "imageKey"):
|
|
if kw in resp.text:
|
|
hits.append((name, kw))
|
|
|
|
print("kw hits:", hits)
|
|
for name, kw in hits:
|
|
text = open(os.path.join(OUT, name), encoding="utf-8", errors="replace").read()
|
|
for m in re.finditer(kw, text):
|
|
seg = text[max(0, m.start() - 400): m.start() + 400]
|
|
print("=" * 30, name, kw)
|
|
print(seg.replace("\n", " "))
|