diff --git a/steam/master_server.py b/steam/master_server.py index 876ab6e..0ea4d7d 100644 --- a/steam/master_server.py +++ b/steam/master_server.py @@ -40,8 +40,8 @@ Filter code What it does =========================== ========================================================================================================================= """ import socket -import struct -from time import sleep +from struct import pack as _pack, unpack_from as _unpack_from +from time import time as _time from enum import IntEnum, Enum from steam.util.binary import StructReader @@ -96,7 +96,7 @@ def query(filter_text=r'\napp\500', region=MSRegion.World, master=MSServer.Sourc ms.settimeout(8) next_ip = b'0.0.0.0:0' - req_prefix = b'1' + struct.pack('>B', region) + req_prefix = b'1' + _pack('>B', region) req_suffix = b'\x00' + filter_text.encode('utf-8') + b'\x00' while True: @@ -121,3 +121,181 @@ def query(filter_text=r'\napp\500', region=MSRegion.World, master=MSServer.Sourc yield ip, port next_ip = '{}:{}'.format(ip, port).encode('utf-8') + + +def _handle_a2s_response(sock): + packet = sock.recv(2048) + header, = _unpack_from('