修正活动WSS AUTH帧对齐9.1抓包字节
This commit is contained in:
+18
-2
@@ -568,12 +568,28 @@ class HuyaWssClient:
|
||||
return body
|
||||
|
||||
async def send_auth(self, uid: int, cookie: str, sequence: int = SEQ_WSLAUNCH):
|
||||
"""cmd 0x0a AUTH — 发送 TAF 认证结构(与 9.1 活动帧一致)。"""
|
||||
"""cmd 0x0a AUTH — 对齐 9.1 抓包(828 活动帧)。
|
||||
|
||||
9.1 活动 AUTH 结构(逐字节核验):
|
||||
tag3 ZERO ← 首字段(活动通道)
|
||||
tag0 INT64 = uid
|
||||
tag1 STRING1 = UA
|
||||
tag2 STRING4 = cookie(含 huya_ua= 前缀)
|
||||
tag3 STRING1 = guid(32hex,9.1 中为页面 Cookie 的 guid)
|
||||
tag4 INT8 = 1
|
||||
tag5 STRING1 = "HUYA&ZH&2052"
|
||||
tag6 STRING1 = ""
|
||||
+= TAIL_BYTES(tag2 ZERO/tag3 ""/tag4 ZERO/tag5 ZERO/tag6 "")
|
||||
"""
|
||||
os = TafOutputStream()
|
||||
if self._activity_mode:
|
||||
os.write_head(3, TafType.ZERO)
|
||||
os.write_int64(0, int(uid or 0))
|
||||
os.write_string(1, WSS_COOKIE_UA)
|
||||
os.write_string(2, HuyaWssClient._normalize_biz_cookie(cookie))
|
||||
os.write_int32(3, 0)
|
||||
guid_match = re.search(r"(?:^|;\s*)guid=([^;]+)", cookie or "")
|
||||
guid = (guid_match.group(1).strip() if guid_match else "") or self._launch_guid
|
||||
os.write_string(3, guid or "")
|
||||
os.write_int8(4, 1)
|
||||
os.write_string(5, "HUYA&ZH&2052")
|
||||
os.write_string(6, "")
|
||||
|
||||
Reference in New Issue
Block a user