From 0af57a1e863c3bcf68f56b4831f5b92673db289a Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 26 Dec 2023 17:05:35 +0200 Subject: [PATCH] add key encoding fix by @a1batross #1542 --- pymaster.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pymaster.py b/pymaster.py index e97c154..7e2bde3 100755 --- a/pymaster.py +++ b/pymaster.py @@ -126,8 +126,8 @@ class PyMaster: clver = v elif k == 'protocol': protocol = int(v) - elif k == 'key': # defined but not implemented yet - key = v + elif k == 'key': + key = int(v, 16) # somebody is playing :) elif k == 'thisismypcid' or k == 'heydevelopersifyoureadthis': self.fakeInfoForOldVersions(gamedir, addr) @@ -142,6 +142,10 @@ class PyMaster: return packet = MasterProtocol.queryPacketHeader + + if key != None: + packet += b'\x7F' + pack(' i.die: self.serverList.remove(i) @@ -161,9 +165,6 @@ class PyMaster: data = ('\xff\xff\xff\xffc %s:%d' % (addr[0], addr[1])).encode('latin_1') self.sock.sendto(data, i.addr) - if key: - packet += b"\x7f" + key.encode('latin_1') - # Use pregenerated address string packet += i.queryAddr packet += b'\0\0\0\0\0\0' # Fill last IP:Port with \0