コード例 #1
0
def connect(sg_uuid, public_key_type, public_key, iv, userhash, jwt, msg_num,
            num_start, num_end):
    """
    Assemble ConnectRequest SimpleMessage.

    Args:
        sg_uuid (UUID): Client Uuid, randomly generated.
        public_key_type (:class:`PublicKeyType`): Public Key Type.
        public_key (bytes): Calculated Public Key, from :class:`Crypto`.
        iv (bytes): Initialization Vector for this encrypted message.
        userhash (str): Xbox Live Account userhash.
        jwt (str): Xbox Live Account JWT / Auth-token.
        msg_num (int): Current message number (important for fragmentation).
        num_start (int): Base number start of ConnectRequest fragments.
        num_end (int): Base number end of ConnectRequest fragments
                       (base number start + total fragments + 1).

    Returns:
        :class:`XStructObj`: Instance of :class:`:class:`XStructObj``.
    """
    return simple.struct(
        header=simple.header(pkt_type=PacketType.ConnectRequest),
        unprotected_payload=simple.connect_request_unprotected(
            sg_uuid=sg_uuid,
            public_key_type=public_key_type,
            public_key=public_key,
            iv=iv),
        protected_payload=simple.connect_request_protected(
            userhash=userhash,
            jwt=jwt,
            connect_request_num=msg_num,
            connect_request_group_start=num_start,
            connect_request_group_end=num_end))
コード例 #2
0
def power_on(liveid):
    """
    Assemble PowerOn Request message.

    Args:
        liveid (str): The console LiveId (extracted from the
                      :class:`DiscoveryResponse` Certificate).

    Returns:
        :class:`XStructObj`: Instance of :class:`:class:`XStructObj``.
    """
    return simple.struct(
        header=simple.header(pkt_type=PacketType.PowerOnRequest, version=0),
        unprotected_payload=simple.power_on_request(liveid=liveid))
コード例 #3
0
def discovery(client_type=ClientType.Android):
    """
    Assemble DiscoveryRequest SimpleMessage.

    Args:
        client_type (:class:`ClientType`): Member of :class:`ClientType`, defaults to
                           `ClientType.Android`.

    Returns:
        :class:`XStructObj`: Instance of :class:`:class:`XStructObj``.
    """
    return simple.struct(
        header=simple.header(pkt_type=PacketType.DiscoveryRequest, version=0),
        unprotected_payload=simple.discovery_request(flags=0,
                                                     client_type=client_type,
                                                     minimum_version=0,
                                                     maximum_version=2))