From bbddbbf646a6bcd5ffa6cd330da084258f3be45e Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 1 Mar 2022 12:58:39 -0500 Subject: [PATCH] Patch issue where guid was a string trying to be made into bytes --- app/classes/minecraft/mc_ping.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/classes/minecraft/mc_ping.py b/app/classes/minecraft/mc_ping.py index ba9f44d3..ae1833c7 100644 --- a/app/classes/minecraft/mc_ping.py +++ b/app/classes/minecraft/mc_ping.py @@ -3,8 +3,10 @@ import socket import base64 import json import os -import sys +import re import logging.config +import uuid +import random from app.classes.shared.console import console from app.classes.minecraft.bedrock_ping import BedrockPing @@ -170,11 +172,15 @@ def ping(ip, port): # For the rest of requests see wiki.vg/Protocol def ping_bedrock(ip, port): - if len(sys.argv) > 3: - client_guid = sys.argv[3] - else: - client_guid = 0 + rd = random.Random() try: + rd.seed(''.join(re.findall('..', '%012x' % uuid.getnode()))) + client_guid = uuid.UUID(int=rd.getrandbits(32)).int + except: + client_guid = 0 + print(client_guid) + try: + print(client_guid) brp = BedrockPing(ip, port, client_guid) return brp.ping() except socket.timeout: