Exemplo n.º 1
0
    def t512(cls, data: bytes) -> Dict[str, Any]:
        data_ = Packet(data)
        offset = 0
        length = data_.read_uint16()
        offset += 2

        ps_key_map: Dict[str, bytes] = {}
        pt4_token_map: Dict[str, bytes] = {}
        for _ in range(length):
            domain_length = data_.read_uint16(offset)
            offset += 2
            domain = data_.read_bytes(domain_length, offset).decode()
            offset += domain_length

            key_length = data_.read_uint16(offset)
            offset += 2
            ps_key = data_.read_bytes(key_length, offset)
            offset += key_length

            token_length = data_.read_uint16(offset)
            offset += 2
            ps4_token = data_.read_bytes(token_length, offset)
            offset += token_length

            ps_key_map[domain] = ps_key
            pt4_token_map[domain] = ps4_token

        return {"ps_key_map": ps_key_map, "pt4_token_map": pt4_token_map}
Exemplo n.º 2
0
    def t200(cls, data: bytes) -> Dict[str, Any]:
        """Decode tlv 200 data.

        Data:
            * pf (bytes)
            * pf_key (bytes)

        Note:
            Source: oicq.wlogin_sdk.tlv_type.tlv_t200
        """
        data_ = Packet(data)
        offset = 0
        pf_length = data_.read_uint16(offset)
        offset += 2 + pf_length
        key_length = data_.read_uint16(offset)
        return {
            "pf": data_.read_bytes(pf_length, 2),
            "pf_key": data_.read_bytes(key_length, offset + 2),
        }
Exemplo n.º 3
0
    def t199(cls, data: bytes) -> Dict[str, Any]:
        """Decode tlv 199 data.

        Data:
            * open_id (bytes)
            * pay_token (bytes)

        Note:
            Source: oicq.wlogin_sdk.tlv_type.tlv_t199
        """
        data_ = Packet(data)
        offset = 0
        id_length = data_.read_uint16(offset)
        offset += 2 + id_length
        token_length = data_.read_uint16(offset)
        return {
            "open_id": data_.read_bytes(id_length, 2),
            "pay_token": data_.read_bytes(token_length, offset + 2),
        }
Exemplo n.º 4
0
    def t125(cls, data: bytes) -> Dict[str, Any]:
        """Decode tlv 125 data.

        Data:
            * open_id (bytes)
            * open_key (bytes)

        Note:
            Source: oicq.wlogin_sdk.tlv_type.tlv_t125
        """
        data_ = Packet(data)
        offset = 0
        id_length = data_.read_uint16(offset)
        offset += 2 + id_length
        key_length = data_.read_uint16(offset)
        return {
            "open_id": data_.read_bytes(id_length, 2),
            "open_key": data_.read_bytes(key_length, offset + 2),
        }
Exemplo n.º 5
0
    def t11a(cls, data: bytes) -> Dict[str, Any]:
        """Decode tlv 11a data.

        Data:
            * face (bytes(2))
            * age (int)
            * gender (int)
            * nick (str)

        Note:
            Source: oicq.wlogin_sdk.tlv_type.tlv_t11a
        """
        data_ = Packet(data)
        return {
            "face":
            data_.read_bytes(2),
            "age":
            data_.read_uint8(offset=2),
            "gender":
            data_.read_uint8(offset=3),
            "nick":
            data_.read_bytes(data_.read_uint8(offset=4), offset=5).decode(),
        }
Exemplo n.º 6
0
    def t130(cls, 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

        Note:
            Source: oicq.wlogin_sdk.tlv_type.tlv_t130
        """
        data_ = Packet(data)
        return {
            "time_diff": data_.read_int32(offset=2) - int(time.time()),
            "ip_address": data_.read_bytes(4, offset=6),
        }