diff --git a/aiotieba/client/_client.py b/aiotieba/client/_client.py index 0ad8c895..b26e4edd 100644 --- a/aiotieba/client/_client.py +++ b/aiotieba/client/_client.py @@ -2064,7 +2064,7 @@ async def send_msg(self, _id: Union[str, int], content: str) -> bool: from . import send_msg proto = send_msg.pack_proto(user_id, content, self.websocket._record_id) - body = await self.websocket.send(proto, send_msg.CMD, encrypt=False, timeout=5.0) + body = await self.websocket.send(proto, send_msg.CMD, timeout=5.0) send_msg.parse_body(body) except Exception as err: diff --git a/aiotieba/client/_core.py b/aiotieba/client/_core.py index fc89300b..2d7baf93 100644 --- a/aiotieba/client/_core.py +++ b/aiotieba/client/_core.py @@ -395,7 +395,7 @@ def aes_ecb_chiper(self): if self._aes_ecb_chiper is None: salt = b'\xa4\x0b\xc8\x34\xd6\x95\xf3\x13' - ws_secret_key = hashlib.pbkdf2_hmac('sha1', b"0123456789abcdefghyjklmnopqrstu", salt, 5, 32) + ws_secret_key = hashlib.pbkdf2_hmac('sha1', self.aes_ecb_sec_key, salt, 5, 32) self._aes_ecb_chiper = AES.new(ws_secret_key, AES.MODE_ECB) return self._aes_ecb_chiper diff --git a/aiotieba/client/_websocket/_classdef.py b/aiotieba/client/_websocket/_classdef.py index 9d6623ce..c65f8827 100644 --- a/aiotieba/client/_websocket/_classdef.py +++ b/aiotieba/client/_websocket/_classdef.py @@ -191,7 +191,7 @@ async def send( _REQ_ID += 1 req_id = _REQ_ID - req_data = pack_ws_bytes(self._core, data, cmd, req_id, compress, encrypt) + req_data = pack_ws_bytes(self._core, data, cmd, req_id, compress=compress, encrypt=encrypt) res_future = asyncio.Future() self._res_waiter[req_id] = res_future diff --git a/aiotieba/client/_websocket/_helper.py b/aiotieba/client/_websocket/_helper.py index eec86fad..0f353794 100644 --- a/aiotieba/client/_websocket/_helper.py +++ b/aiotieba/client/_websocket/_helper.py @@ -8,7 +8,7 @@ def pack_ws_bytes( - core: TbCore, data: bytes, cmd: int, req_id: int, compress: bool = False, encrypt: bool = True + core: TbCore, data: bytes, cmd: int, req_id: int, *, compress: bool = False, encrypt: bool = True ) -> bytes: """ 打包数据并添加9字节头部