Files
ykxmz/_build/update_pkg_test.py
T
xmz7891 7f267dd900 ykxmz 1.5.0锛氭墜琛ㄧ TLS 璇佷功鍏煎 + 涓夌鍒嗗紑鎵撳寘 + 涓嬭浇鍖?
鎵嬭〃绔?- 鍐呯疆 GTS Root R4 / GlobalSign Root CA
  淇?SSLHandshakeException: Chain validation failed
  锛堝粔浠锋墜琛ㄧ郴缁熸牴璇佷功搴撳父缂?GTS Root R4锛?- 杩炴帴閿欒缈昏瘧鎴愪汉璇濓細璇佷功 / 鏃堕棿 / 瑙f瀽 / 瓒呮椂鍒嗗埆缁欐彁绀?- 缁忎腑杞繛涓婂悗鐢ㄦ湇鍔″櫒鎶ョ殑鍦板潃鍒锋柊宸查厤瀵硅褰曪紙鍘熸潵涓€鐩存樉绀烘棫 IP锛?- 鐗堟湰鍙?1.3.0 -> 1.5.0锛圓ndroidManifest 涔嬪墠婕忔敼浜嗭級

鏈嶅姟鍣ㄧ
- 鏀寔 chunked 璇锋眰浣擄細淇瘡 16 绉掍竴娆$殑杩炴帴閿欎贡涓庡ぇ闈㈢Н 502
- 缃戠粶璋冧紭 net-tune.sh锛氬す MSS 1400 + 璺緞 MTU 鎺㈡祴
  锛堝叕缃戝彲鐢ㄧ巼 48% -> 100%锛屽疄娴?15 鍒嗛挓 180/180锛?  鍋氭垚寮€鏈烘湇鍔?lanremote-nettune.service锛屽苟浼氳嚜鍔ㄩ噸寤洪毀閬?- 鏂板涓嬭浇鍖猴細GET /v1/downloads 鍒楄〃 + GET /download/<鏂囦欢>
  鍙厑璁哥櫧鍚嶅崟鍚庣紑銆佷弗鏍兼牎楠屾枃浠跺悕锛堟尅鐩綍绌胯秺锛?  绠$悊椤靛姞涓嬭浇鍗$墖
- 闅ч亾鏀?HTTP/2 + 鍙岃繛鎺ワ紙QUIC 鍦ㄨ繖鏉$嚎璺笂鍙敤鐜囧彧鏈?48%锛?- 缃戠粶浣撴銆佹壒閲忓垹闄よ澶?
鎵撳寘鏂瑰紡鍙樻洿
- 鍘熸潵鏄笁涓儴鍒嗗悎鎴愪竴涓?zip锛岀幇鍦?*鍒嗘垚涓変釜鐙珛浜х墿**锛?    ykxmz-agent-1.5.0.zip    琚帶绔?    ykxmz-server-1.5.0.zip   鏈嶅姟鍣ㄧ
    ykxmz-watch-1.5.0.apk    鎺у埗绔紙鐩存帴缁?APK锛屼笉鎵?zip锛?  涓変釜鍖?鏂囦欢閮藉甫涓婅鍙崗璁?/ 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭?
鏂囨。
- 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
2026-10-06 19:08:02 +08:00

173 lines
6.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
r"""把 test_package_remote.py 改成适配"三端分开出"。
原来:
ZIP = dist/ykxmz-1.5.0.zip (一个合并包)
解压后是 1-agent/ 2-server/ 3-watch/ + 顶层 README
现在:
dist/ykxmz-agent-1.5.0.zip 被控端
dist/ykxmz-server-1.5.0.zip 服务器端
dist/ykxmz-watch-1.5.0.apk 控制端(直接给)
测试要验证的东西不变(三部分内容完整、能跑起来、文档带 BOM),
只是"从哪拿"变了。
"""
from __future__ import annotations
import ast
import re
import sys
from pathlib import Path
TEST = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\_tests"
r"\test_package_remote.py")
OLD_HEAD = '''ROOT = Path(__file__).resolve().parent.parent
ZIP = ROOT / "dist" / "ykxmz-1.5.0.zip"'''
NEW_HEAD = '''ROOT = Path(__file__).resolve().parent.parent
# 三端分开出(用户要求):
# 被控端 -> 一个 zip
# 服务器端 -> 一个 zip
# 控制端 -> 直接给 APK(不打 zip)
AGENT_ZIP = ROOT / "dist" / "ykxmz-agent-1.5.0.zip"
SERVER_ZIP = ROOT / "dist" / "ykxmz-server-1.5.0.zip"
WATCH_APK = ROOT / "dist" / "ykxmz-watch-1.5.0.apk"'''
OLD_OPEN = '''def main() -> int:
if not ZIP.is_file():
print(f" 找不到 {ZIP}")
return 1
work = Path(tempfile.mkdtemp(prefix="verify_pkg_"))
relay_proc = agent_proc = None
try:
# ---------------- 1. 解压 ----------------
print("一、解压")
with zipfile.ZipFile(ZIP) as archive:
archive.extractall(work)
top = work / ZIP.stem
check("顶层目录存在", top.is_dir(), top)
agent_dir = top / "1-agent"
relay_dir = top / "2-server"
watch_dir = top / "3-watch"
check("三个部分目录都在",
agent_dir.is_dir() and relay_dir.is_dir() and watch_dir.is_dir())
check("顶层说明在", (top / "README.txt").is_file())
exe = agent_dir / "ykxmz.exe"
relay_py = relay_dir / "relay.py"
install_sh = relay_dir / "install.sh"
apk = next(watch_dir.glob("*.apk"), None)
check("被控端 EXE 在", exe.is_file())
check("服务器端 relay.py 在", relay_py.is_file())
check("服务器端 install.sh 在", install_sh.is_file())
check("控制端 APK 在", apk is not None, apk)
# 说明文档要有 BOM(否则记事本会认成 GBK 乱码)
for label, path in (("顶层", top / "README.txt"),
("被控端", agent_dir / "README-agent.txt"),
("服务器端", relay_dir / "README-server.txt"),
("控制端", watch_dir / "README-watch.txt")):
raw = path.read_bytes() if path.is_file() else b""
check(f"{label}说明有 UTF-8 BOM",
raw[:3] == b"\\xef\\xbb\\xbf", raw[:3])'''
NEW_OPEN = '''def main() -> int:
# 1) 三个产物都要在
for label, path in (("被控端包", AGENT_ZIP), ("服务器端包", SERVER_ZIP),
("控制端 APK", WATCH_APK)):
if not path.is_file():
print(f" 找不到{label}: {path}")
return 1
work = Path(tempfile.mkdtemp(prefix="verify_pkg_"))
relay_proc = agent_proc = None
try:
# ---------------- 1. 解压两个 zip ----------------
print("一、解压(两个 zip)")
with zipfile.ZipFile(AGENT_ZIP) as archive:
archive.extractall(work)
with zipfile.ZipFile(SERVER_ZIP) as archive:
archive.extractall(work)
# 两个包各自带一层版本目录
agent_dir = work / AGENT_ZIP.stem
relay_dir = work / SERVER_ZIP.stem
check("被控端目录存在", agent_dir.is_dir(), agent_dir)
check("服务器端目录存在", relay_dir.is_dir(), relay_dir)
exe = agent_dir / "ykxmz.exe"
relay_py = relay_dir / "relay.py"
install_sh = relay_dir / "install.sh"
apk = WATCH_APK
check("被控端 EXE 在", exe.is_file())
check("服务器端 relay.py 在", relay_py.is_file())
check("服务器端 install.sh 在", install_sh.is_file())
check("服务器端带了网络调优脚本", (relay_dir / "net-tune.sh").is_file())
check("服务器端带了看门狗", (relay_dir / "watchdog.sh").is_file())
check("控制端 APK 在(直接在 dist 里)", apk.is_file(), apk)
# 说明文档要有 BOM(否则记事本会认成 GBK 乱码)
for label, path in (("被控端", agent_dir / "README-agent.txt"),
("服务器端", relay_dir / "README-server.txt"),
("控制端(旁边那份)",
ROOT / "dist" / "ykxmz-watch-1.5.0-说明.txt")):
raw = path.read_bytes() if path.is_file() else b""
check(f"{label}说明有 UTF-8 BOM",
raw[:3] == b"\\xef\\xbb\\xbf", raw[:3])
# 三份正式文档:两个包里都要有
for label, base in (("被控端包", agent_dir), ("服务器端包", relay_dir)):
for doc in ("LICENSE.txt", "BEFORE-INSTALL.txt",
"AFTER-INSTALL.txt"):
check(f"{label}带了 {doc}", (base / doc).is_file())'''
OLD_TOOLS = ''' # 被控端目录里不该有 data / 说明残留
check("没有把 data 目录打进去",
not (agent_dir / "data").exists())'''
NEW_TOOLS = ''' # 被控端目录里不该有 data / 说明残留
check("没有把 data 目录打进去",
not (agent_dir / "data").exists())'''
def main() -> int:
text = TEST.read_text(encoding="utf-8")
if "AGENT_ZIP" in text:
print(" 已经改过")
return 0
ok = True
for old, new, label in ((OLD_HEAD, NEW_HEAD, "产物路径常量"),
(OLD_OPEN, NEW_OPEN, "解压与检查段")):
if old not in text:
print(f" [失败] {label} —— 锚点没找到")
# 打印实际内容帮助定位
key = old.splitlines()[0]
for i, line in enumerate(text.splitlines(), 1):
if line.strip() == key.strip():
print(f" 实际 {i}: {line}")
ok = False
continue
text = text.replace(old, new, 1)
print(f" {label}")
if not ok:
return 1
TEST.write_text(text, encoding="utf-8", newline="\n")
try:
ast.parse(text)
print(" test_package_remote.py 语法 OK")
except SyntaxError as exc:
print(f" 语法错误: 行 {exc.lineno}: {exc.msg}")
return 1
return 0
if __name__ == "__main__":
sys.exit(main())