cai.client.wtlogin package¶
Login Related SDK
This module is used to build and handle login related packet.
- Copyright
Copyright (C) 2021-2021 cscs181
- License
AGPL-3.0 or later. See LICENSE for detail.
- cai.client.wtlogin.encode_login_request2_captcha(seq: int, key: bytes, session_id: bytes, ksid: bytes, uin: int, captcha: str, sign: bytes, t104: bytes) cai.utils.binary.Packet¶
Build submit captcha request packet.
Called in
oicq.wlogin_sdk.request.WtloginHelper.CheckPictureAndGetSt.command id:
0x810 = 2064sub command id:
2command name:
wtlogin.login注解
Source: oicq.wlogin_sdk.request.n
- 参数
seq (int) – Packet sequence.
key (bytes) – 16 bits key used to decode the response.
session_id (bytes) – Session ID.
ksid (bytes) – KSID of client.
uin (int) – User QQ number.
captcha (str) – Captcha image result.
sign (bytes) – Signature of the captcha.
t104 (bytes) – TLV 104 data.
- 返回
Login packet.
- 返回类型
- cai.client.wtlogin.encode_login_request2_slider(seq: int, key: bytes, session_id: bytes, ksid: bytes, uin: int, ticket: str, t104: bytes) cai.utils.binary.Packet¶
Build slider ticket request packet.
Called in
oicq.wlogin_sdk.request.WtloginHelper.CheckPictureAndGetSt.command id:
0x810 = 2064sub command id:
2command name:
wtlogin.login注解
Source: oicq.wlogin_sdk.request.n
- 参数
seq (int) – Packet sequence.
key (bytes) – 16 bits key used to decode the response.
session_id (bytes) – Session ID.
ksid (bytes) – KSID of client.
uin (int) – User QQ number.
ticket (str) – Captcha image result.
t104 (bytes) – TLV 104 data.
- 返回
Login packet.
- 返回类型
- cai.client.wtlogin.encode_login_request7(seq: int, key: bytes, session_id: bytes, ksid: bytes, uin: int, sms_code: str, t104: bytes, t174: bytes, g: bytes) cai.utils.binary.Packet¶
Build sms submit packet.
Called in
oicq.wlogin_sdk.request.WtloginHelper.CheckSMSAndGetSt.command id:
0x810 = 2064sub command id:
7command name:
wtlogin.login注解
Source: oicq.wlogin_sdk.request.o
- 参数
seq (int) – Packet sequence.
key (bytes) – 16 bits key used to decode the response.
session_id (bytes) – Session ID.
ksid (bytes) – KSID of client.
uin (int) – User QQ number.
sms_code (str) – SMS code.
t104 (bytes) – TLV 104 data.
t174 (bytes) – TLV 174 data.
g (bytes) – G data of client.
- 返回
Login packet.
- 返回类型
- cai.client.wtlogin.encode_login_request8(seq: int, key: bytes, session_id: bytes, ksid: bytes, uin: int, t104: bytes, t174: bytes) cai.utils.binary.Packet¶
Build sms request packet.
Called in
oicq.wlogin_sdk.request.WtloginHelper.RefreshSMSData.command id:
0x810 = 2064sub command id:
8command name:
wtlogin.login注解
Source: oicq.wlogin_sdk.request.r
- 参数
seq (int) – Packet sequence.
key (bytes) – 16 bits key used to decode the response.
session_id (bytes) – Session ID.
ksid (bytes) – KSID of client.
uin (int) – User QQ number.
t104 (bytes) – TLV 104 data.
t174 (bytes) – TLV 174 data.
- 返回
Login packet.
- 返回类型
- cai.client.wtlogin.encode_login_request9(seq: int, key: bytes, session_id: bytes, ksid: bytes, uin: int, password_md5: bytes) cai.utils.binary.Packet¶
Build main login request packet.
Called in
oicq.wlogin_sdk.request.WtloginHelper.GetStWithPasswd.command id:
0x810 = 2064sub command id:
9command name:
wtlogin.login注解
Source: oicq.wlogin_sdk.request.k
- 参数
seq (int) – Packet sequence.
key (bytes) – 16 bits key used to decode the response.
session_id (bytes) – Session ID.
ksid (bytes) – KSID of client.
uin (int) – User QQ number.
password_md5 (bytes) – User QQ password md5 hash.
- 返回
Login packet.
- 返回类型
- cai.client.wtlogin.encode_login_request20(seq: int, key: bytes, session_id: bytes, ksid: bytes, uin: int, t104: bytes, g: bytes) cai.utils.binary.Packet¶
Build device lock login request packet.
Called in
oicq.wlogin_sdk.request.WtloginHelper.GetStWithoutPasswd.command id:
0x810 = 2064sub command id:
20command name:
wtlogin.login注解
Source: oicq.wlogin_sdk.request.p
- 参数
seq (int) – Packet sequence.
key (bytes) – 16 bits key used to decode the response.
session_id (bytes) – Session ID.
ksid (bytes) – KSID of client.
uin (int) – User QQ number.
t104 (bytes) – T104 response data.
g (bytes) – md5 of (guid + dpwd + t402).
- 返回
Login packet.
- 返回类型
- cai.client.wtlogin.encode_exchange_emp_10() cai.utils.binary.Packet¶
- cai.client.wtlogin.encode_exchange_emp_15(seq: int, session_id: bytes, uin: int, g: bytes, dpwd: bytes, no_pic_sig: bytes, encrypted_a1: bytes, rand_seed: bytes, wt_session_ticket: bytes, wt_session_ticket_key: bytes) cai.utils.binary.Packet¶
Build exchange emp request packet.
command id:
0x810 = 2064sub command id:
15command name:
wtlogin.exchange_emp注解
Source: oicq.wlogin_sdk.request.aa
- 参数
seq (int) – Packet sequence.
session_id (bytes) – Session ID.
ksid (bytes) – KSID of client.
uin (int) – User QQ number.
g (bytes) – Siginfo g.
dpwd (bytes) – Siginfo dpwd.
no_pic_sig (bytes) – Siginfo no pic sig.
encrypted_a1 (bytes) – Siginfo Encrypted A1.
rand_seed (bytes) – Siginfo random seed.
wt_session_ticket (bytes) – Siginfo session ticket.
wt_session_ticket_key (bytes) – Siginfo session ticket key.
- 返回
Exchange emp packet.
- 返回类型
- async cai.client.wtlogin.handle_oicq_response(client: Client, packet: cai.client.packet.IncomingPacket) cai.client.wtlogin.oicq.OICQResponse¶
Submodules¶
cai.client.wtlogin.oicq module¶
OICQ Packet Builder
This module is used to build and handle OICQ packets.
- Copyright
Copyright (C) 2021-2021 cscs181
- License
AGPL-3.0 or later. See LICENSE for detail.
- class cai.client.wtlogin.oicq.OICQRequest(*args, **kwargs)¶
-
Build OICQ Request Packet
注解
Source: oicq.wlogin_sdk.request.oicq_request
- classmethod build_encoded(uin: int, command_id: int, encoded: Union[bytes, cai.utils.binary.Packet], encoder_id: int) cai.client.wtlogin.oicq.OICQRequest¶
- class cai.client.wtlogin.oicq.OICQResponse(uin: int, seq: int, ret_code: int, command_name: str)¶
-
- classmethod decode_response(uin: int, seq: int, ret_code: int, command_name: str, data: bytes) cai.client.wtlogin.oicq.OICQResponse¶
Decode login response and wrap main info of the response.
注解
Source: oicq.wlogin_sdk.request.WtloginHelper.GetStWithPasswd
- 参数
uin (int) – User QQ
seq (int) – Sequence number of the response packet.
ret_code (int) – Return code of the response.
command_name (str) – Command name of the response.
data (bytes) – Payload data of the response.
- 返回
Login success. NeedCaptcha: Captcha image needed. AccountFrozen: Account is frozen. DeviceLocked: Device lock detected. TooManySMSRequest: Too many SMS messages were sent. DeviceLockLogin: More login packet needed. UnknownLoginStatus: Unknown login status. OICQResponse: Invalid login response.
- 返回类型
- uin: int¶
- seq: int¶
- ret_code: int¶
- command_name: str¶
- class cai.client.wtlogin.oicq.UnknownLoginStatus(uin: int, seq: int, ret_code: int, command_name: str, sub_command: int, status: int, _tlv_map: Dict[int, Any])¶
基类:
cai.client.wtlogin.oicq.OICQResponse- sub_command: int¶
- status: int¶
- t402: Optional[bytes]¶
- class cai.client.wtlogin.oicq.LoginSuccess(uin: int, seq: int, ret_code: int, command_name: str, sub_command: int, status: int, _tlv_map: Dict[int, Any])¶
基类:
cai.client.wtlogin.oicq.UnknownLoginStatus- t150: Optional[bytes]¶
- rollback_sig: Optional[bytes]¶
- rand_seed: Optional[bytes]¶
- time_diff: Optional[int]¶
- ip_address: Optional[bytes]¶
- t528: Optional[bytes]¶
- t530: Optional[bytes]¶
- tgt_key: bytes¶
- user_st_key: bytes¶
- tgt: bytes¶
- user_st: bytes¶
- nick: Optional[str]¶
- age: Optional[int]¶
- gender: Optional[int]¶
- user_st_web_sig: bytes¶
- ksid: Optional[bytes]¶
- s_key: bytes¶
- pwd_flag: Optional[bool]¶
- encrypted_a1: bytes¶
- no_pic_sig: bytes¶
- d2: bytes¶
- d2key: bytes¶
- ps_key_map: Dict[str, bytes]¶
- pt4_token_map: Dict[str, bytes]¶
- wt_session_ticket: bytes¶
- wt_session_ticket_key: bytes¶
- device_token: Optional[bytes]¶
- class cai.client.wtlogin.oicq.NeedCaptcha(uin: int, seq: int, ret_code: int, command_name: str, sub_command: int, status: int, _tlv_map: Dict[int, Any])¶
基类:
cai.client.wtlogin.oicq.UnknownLoginStatus- t104: bytes¶
- verify_url: str¶
- captcha_sign: bytes¶
- captcha_image: bytes¶
- class cai.client.wtlogin.oicq.AccountFrozen(uin: int, seq: int, ret_code: int, command_name: str, sub_command: int, status: int, _tlv_map: Dict[int, Any])¶
基类:
cai.client.wtlogin.oicq.UnknownLoginStatus- sub_command: int¶
- status: int¶
- t402: Optional[bytes]¶
- uin: int¶
- seq: int¶
- ret_code: int¶
- command_name: str¶
- class cai.client.wtlogin.oicq.DeviceLocked(uin: int, seq: int, ret_code: int, command_name: str, sub_command: int, status: int, _tlv_map: Dict[int, Any])¶
基类:
cai.client.wtlogin.oicq.UnknownLoginStatus- verify_url: Optional[str]¶
- message: Optional[str]¶
- rand_seed: Optional[bytes]¶
- t104: Optional[bytes]¶
- t174: Optional[bytes]¶
- sms_phone: Optional[str]¶
- class cai.client.wtlogin.oicq.TooManySMSRequest(uin: int, seq: int, ret_code: int, command_name: str, sub_command: int, status: int, _tlv_map: Dict[int, Any])¶
基类:
cai.client.wtlogin.oicq.UnknownLoginStatus- sub_command: int¶
- status: int¶
- t402: Optional[bytes]¶
- uin: int¶
- seq: int¶
- ret_code: int¶
- command_name: str¶
- class cai.client.wtlogin.oicq.DeviceLockLogin(uin: int, seq: int, ret_code: int, command_name: str, sub_command: int, status: int, _tlv_map: Dict[int, Any])¶
基类:
cai.client.wtlogin.oicq.UnknownLoginStatus- rand_seed: Optional[bytes]¶
- t104: Optional[bytes]¶
cai.client.wtlogin.tlv module¶
TLV Tools
This module is used to build and handle tlv bytes.
- Copyright
Copyright (C) 2021-2021 cscs181
- License
AGPL-3.0 or later. See LICENSE for detail.
- class cai.client.wtlogin.tlv.TlvEncoder¶
基类:
object- classmethod t1(uin: int, server_time: int, ip: bytes, ip_version: int = 1) Packet[()]¶
- classmethod t2(captcha: bytes, sign: bytes) Packet[()]¶
- classmethod t8(local_id: int, i: int = 0, i2: int = 0) Packet[()]¶
- classmethod t18(app_id: int, app_client_version: int, uin: int, _ping_version: int = 1, _sso_version: int = 1536, unknown: int = 0) Packet[()]¶
- classmethod t100(sso_version: int, app_id: int, sub_app_id: int, app_client_version: int, sigmap: int, _db_buf_ver: int = 1) Packet[()]¶
- classmethod t104(data: bytes) Packet[()]¶
- classmethod t106(sso_version: int, app_id: int, sub_app_id: int, app_client_version: int, uin: int, salt: int, password_md5: bytes, guid: bytes, tgtgt_key: bytes, ip: bytes = b'\x00\x00\x00\x00', save_password: bool = True, login_type: int = 1) Packet[()]¶
- classmethod t107(pic_type: int = 0, cap_type: int = 0, pic_size: int = 0, ret_type: int = 1) Packet[()]¶
- classmethod t108(ksid: str) Packet[()]¶
- classmethod t109(android_id: bytes) Packet[()]¶
- classmethod t10a(arr: bytes) Packet[()]¶
- classmethod t112(non_number_uin: bytes) Packet[()]¶
- classmethod t116(bitmap: int, sub_sigmap: int, sub_app_id_list: List[int] = [1600000226], _ver: int = 0) Packet[()]¶
- classmethod t124(os_type: bytes, os_version: bytes, network_type: int, sim_info: bytes, apn: bytes, address: bytes = b'') Packet[()]¶
- classmethod t128(is_guid_from_file_null: bool, is_guid_available: bool, is_guid_changed: bool, guid_flag: int, build_model: bytes, guid: bytes, build_brand: bytes) Packet[()]¶
- GUID_SRC
0: 初始值
1: 以前保存的文件
17: 以前没保存但现在生成成功
20: 以前没保存且现在生成失败
- GUID_CHANGE_FLAG
mac != current mac:
GUID_CHANGE_FLAG |= 0x1android_id != current android_id:
GUID_CHANGE_FLAG |= 0x2guid != current guid:
GUID_CHANGE_FLAG |= 0x4
Example
>>> GUID_FLAG = 0 >>> GUID_FLAG |= GUID_SRC << 24 & 0xFF000000 >>> GUID_FLAG |= GUID_CHANGE_FLAG << 8 & 0xFF00
- classmethod t141(sim_info: bytes, network_type: int, apn: bytes, _version: int = 1) Packet[()]¶
- classmethod t142(apk_id: str, _version: int = 0) Packet[()]¶
- classmethod t143(arr: bytes) Packet[()]¶
- classmethod t144(imei: bytes, bootloader: str, proc_version: str, codename: str, incremental: str, fingerprint: str, boot_id: str, android_id: str, baseband: str, inner_version: str, os_type: bytes, os_version: bytes, network_type: int, sim_info: bytes, apn: bytes, is_guid_from_file_null: bool, is_guid_available: bool, is_guid_changed: bool, guid_flag: int, build_model: bytes, guid: bytes, build_brand: bytes, tgtgt_key: bytes) Packet[()]¶
- classmethod t145(guid: bytes) Packet[()]¶
- classmethod t147(app_id: int, apk_version_name: bytes, apk_signature_md5: bytes) Packet[()]¶
- classmethod t154(seq: int) Packet[()]¶
- classmethod t166(image_type: bytes) Packet[()]¶
- classmethod t16a(no_pic_sig: bytes) Packet[()]¶
- classmethod t16e(build_model: bytes) Packet[()]¶
- classmethod t172(rollback_sig: bytes) Packet[()]¶
- classmethod t174(data: bytes) Packet[()]¶
- classmethod t177(build_time: int, sdk_version: str) Packet[()]¶
- classmethod t17a(sms_app_id: int) Packet[()]¶
- classmethod t17c(code: str) Packet[()]¶
- classmethod t185() Packet[()]¶
- classmethod t187(mac_address: bytes) Packet[()]¶
- classmethod t188(android_id: bytes) Packet[()]¶
- classmethod t191(can_web_verify: int) Packet[()]¶
- classmethod t193(ticket: str) Packet[()]¶
- classmethod t194(imsi_md5: bytes) Packet[()]¶
- classmethod t197(data: bytes = b'\x00') Packet[()]¶
- classmethod t198() Packet[()]¶
- classmethod t19e(value: int = 1) Packet[()]¶
- classmethod t201(channel_id: bytes, client_type: bytes, n: bytes, l: bytes = b'') Packet[()]¶
- classmethod t202(wifi_bssid: bytes, wifi_ssid: bytes) Packet[()]¶
- classmethod t318(tgt_qr: bytes) Packet[()]¶
- classmethod t400(g: bytes, uin: int, guid: bytes, dpwd: bytes, app_id: int, sub_app_id: int, rand_seed: bytes, _version: int = 1) Packet[()]¶
- classmethod t401(data: bytes) Packet[()]¶
- classmethod t511(domains: List[str]) Packet[()]¶
- classmethod t516(source_type: int = 0) Packet[()]¶
- classmethod t521(product_type: int = 0) Packet[()]¶
- classmethod t525(t536: bytearray) Packet[()]¶
- classmethod t52c() Packet[()]¶
- classmethod t52d(bootloader: str, proc_version: str, codename: str, incremental: str, fingerprint: str, boot_id: str, android_id: str, baseband: str, inner_version: str) Packet[()]¶
注解
Source: oicq.wlogin_sdk.tools.util#get_android_dev_info
- classmethod t536(login_extra_data: List[bytes]) Packet[()]¶
- classmethod t544() Packet[()]¶
- class cai.client.wtlogin.tlv.TlvDecoder¶
基类:
object- classmethod decode(data: Union[bytes, bytearray], offset: int = 0, tag_size: int = 2) Dict[int, Any]¶
- classmethod t113(data: bytes) Dict[str, Any]¶
Decode tlv 113 data.
- Data:
uin (int): user QQ number.
注解
Source: oicq.wlogin_sdk.tlv_type.tlv_t113
- classmethod t119(data: bytes) Dict[int, Any]¶
Tea decrypt tlv 119 data.
- Tlv list:
tlv 149: error message (optional).
tlv 543:
tlv 130: further decode.
tlv 113: further decode.
tlv 528:
tlv 530:
tlv 10d: tgt key.
tlv 10e: st key.
tlv 10a: tgt.
tlv 114: st.
tlv 11a: further decode.
tlv 118: main display name.
tlv 103: stwx web sig.
tlv 108: ksid.
tlv 102:
tlv 10b:
tlv 11c: ls key.
tlv 120: skey.
tlv 121: sig64.
tlv 125: further decode.
tlv 186: further decode.
tlv 537: login extra data.
tlv 169:
tlv 167:
tlv 10c:
tlv 106: encrypted a1.
tlv 16a: no pic sig.
tlv 531: further decode.
tlv 136: vkey.
tlv 132: access token.
tlv 143: d2.
tlv 305: d2 key.
tlv 164: sid.
tlv 171: aq sig.
tlv 512: ps key.
tlv 16d: super key.
tlv 199: further decode.
tlv 200: further decode.
tlv 203: pfkey.
tlv 317: da2.
tlv 133: wt session ticket.
tlv 134: wt session ticket key.
tlv 322: device token.
tlv 11f: futher decode. change time and tk_pri.
tlv 138: further decode. a2, lskey, skey, vkey, a8, stweb, d2, sid change time.
tlv 11d: further decode. st and stkey.
注解
Source: oicq.wlogin_sdk.request.oicq_request.d
- classmethod t11a(data: bytes) Dict[str, Any]¶
Decode tlv 11a data.
- Data:
face (bytes(2))
age (int)
gender (int)
nick (str)
注解
Source: oicq.wlogin_sdk.tlv_type.tlv_t11a
- classmethod t125(data: bytes) Dict[str, Any]¶
Decode tlv 125 data.
- Data:
open_id (bytes)
open_key (bytes)
注解
Source: oicq.wlogin_sdk.tlv_type.tlv_t125
- classmethod t130(data: bytes) Dict[str, Any]¶
Decode tlv 130 data.
- Data:
time_diff (int): time difference between server and local.
ip_address (bytes(4)): may be server ip
注解
Source: oicq.wlogin_sdk.tlv_type.tlv_t130
- classmethod t161(data: bytes) Dict[int, bytes]¶
Decode tlv 161 data.
- Tlv list:
tlv 172: rollback sig.
tlv 173: further decode.
tlv 17f: further decode.
注解
Source: oicq.wlogin_sdk.request.oicq_request.a
- classmethod t186(data: bytes) Dict[str, Any]¶
Decode tlv 186 data.
- Data:
pwd_flag (bool)
注解
Source: oicq.wlogin_sdk.tlv_type.tlv_t186
- classmethod t199(data: bytes) Dict[str, Any]¶
Decode tlv 199 data.
- Data:
open_id (bytes)
pay_token (bytes)
注解
Source: oicq.wlogin_sdk.tlv_type.tlv_t199
- classmethod t200(data: bytes) Dict[str, Any]¶
Decode tlv 200 data.
- Data:
pf (bytes)
pf_key (bytes)
注解
Source: oicq.wlogin_sdk.tlv_type.tlv_t200
- classmethod t512(data: bytes) Dict[str, Any]¶
- classmethod t531(data: bytes) Dict[str, Any]¶
Tea decrypt tlv 119 data.
- Tlv list:
tlv 106: a1 part.
tlv 10c: a1 part.
tlv 16a: no pic sig.
tlv 113:
注解
Source: oicq.wlogin_sdk.request.oicq_request.d