예제 #1
0
    def packet_handshake(self, buff):
        buff2 = deepcopy(buff)
        super().packet_handshake(buff)

        p_protocol_version = buff2.unpack_varint()
        p_connect_host = buff2.unpack_string()

        # Bungeecord ip forwarding, ip/uuid is included in host string separated by \00s
        split_host = str.split(p_connect_host, "\00")

        if len(split_host) >= 3:
            # TODO: Should probably verify the encrypted data in some way.
            # Not important until something on this server uses uuids
            if split_host[1] == 'Geyser-Floodgate':
                self.is_bedrock = True

                host = split_host[4]
                online_uuid = split_host[5]
            elif split_host[1].startswith('^Floodgate^'):
                self.is_bedrock = True

                host = split_host[2]
                online_uuid = split_host[3]
            else:
                host = split_host[1]
                online_uuid = split_host[2]

            self.forwarded_host = host
            self.forwarded_uuid = UUID.from_hex(online_uuid)

        version = None

        for pv, v in self.versions.items():
            if p_protocol_version >= pv:
                version = v

        if version is not None:
            self.version = version(self, self.is_bedrock)
        else:
            self.close("Unsupported Minecraft Version")
예제 #2
0
 def generate_uuid(self):
     return QuarryUUID.from_hex(py_uuid.uuid4().hex)
예제 #3
0
def test_uuid_from_hex_to_byte():
    uuid = UUID.from_hex(hex_vector)
    assert isinstance(uuid, UUID)
    assert uuid.to_bytes() == bytes_vector
예제 #4
0
파일: server.py 프로젝트: barneygale/quarry
    def auth_ok(self, data):
        """Called when auth with mojang succeeded (online mode only)"""
        self.display_name_confirmed = True
        self.uuid = UUID.from_hex(data['id'])

        self.player_joined()
예제 #5
0
 def _from_response(cls, response):
     return cls(response['clientToken'], response['accessToken'],
                response['selectedProfile']['name'],
                UUID.from_hex(response['selectedProfile']['id']))
예제 #6
0
 def from_token(cls, client_token, access_token, display_name, uuid):
     obj = cls(client_token, access_token, display_name,
               UUID.from_hex(uuid))
     return obj.validate()
예제 #7
0
 def packet_mirror_login_success(self, buff):
     self.player_uuid = UUID.from_hex(buff.unpack_string())
     self.player_username = buff.unpack_string()
     return
예제 #8
0
파일: server.py 프로젝트: vcokltfre/quarry
    def auth_ok(self, data):
        """Called when auth with mojang succeeded (online mode only)"""
        self.display_name_confirmed = True
        self.uuid = UUID.from_hex(data['id'])

        self.player_joined()
예제 #9
0
파일: auth.py 프로젝트: barneygale/quarry
 def _from_response(cls, response):
     return cls(
         response['clientToken'],
         response['accessToken'],
         response['selectedProfile']['name'],
         UUID.from_hex(response['selectedProfile']['id']))
예제 #10
0
파일: auth.py 프로젝트: barneygale/quarry
 def from_token(cls, client_token, access_token, display_name, uuid):
     obj = cls(client_token, access_token,
               display_name, UUID.from_hex(uuid))
     return obj.validate()