diff --git a/gamespy/gs_utility.py b/gamespy/gs_utility.py index d166778..510cec6 100644 --- a/gamespy/gs_utility.py +++ b/gamespy/gs_utility.py @@ -83,7 +83,12 @@ def rc4_encrypt(_key, _data): # This seems to be what Luigi Auriemma calls "Gsmsalg". def prepare_rc4_base64(_key, _data): data = rc4_encrypt(_key, _data) + + if data == None: + data = bytearray() + data.append(0) + return base64.b64encode(buffer(data)) # get the login data from nas.nintendowifi.net/ac from an authtoken @@ -101,12 +106,16 @@ def login_profile_via_parsed_authtoken(authtoken_parsed, db): birth = authtoken_parsed.get('birth', '') # NDS: User's birthday # The Wii does not use passwd, so take another uniquely generated string as the password. - if "passwd" in authtoken_parsed: - password = authtoken_parsed['passwd'] - else: - password = authtoken_parsed['gsbrcd'] + # if "passwd" in authtoken_parsed: + # password = authtoken_parsed['passwd'] + # else: + # password = authtoken_parsed['gsbrcd'] + # console = 1 + + if not "passwd" in authtoken_parsed: console = 1 + password = authtoken_parsed['gsbrcd'] gsbrcd = authtoken_parsed['gsbrcd'] gameid = gsbrcd[:4] uniquenick = utils.base32_encode(int(userid)) + gsbrcd diff --git a/gamespy_backend_server.py b/gamespy_backend_server.py index ad75d5a..a5e890b 100644 --- a/gamespy_backend_server.py +++ b/gamespy_backend_server.py @@ -161,6 +161,7 @@ class GameSpyBackendServer(object): i += 1 while i < len(filters) and filters[i].isdigit(): i += 1 + elif filters[i].isalnum() or filters[i] in special_chars: # Whole numbers or words if filters[i].isdigit(): @@ -303,7 +304,8 @@ class GameSpyBackendServer(object): if valid_filter == False: # Return only anything matched up until this point. logger.log(logging.WARNING, "Invalid filter(s): %s" % (filters)) - stop_search = True + #stop_search = True + continue else: # Use Python to evaluate the query. This method may take a little time but it shouldn't be all that # big of a difference, I think. It takes about 0.0004 seconds per server to determine whether or not it's a @@ -320,7 +322,7 @@ class GameSpyBackendServer(object): if stop_search == True: break - if result == True: + if valid_filter == True and result == True: matched_servers.append(server) if max_count != 0 and len(matched_servers) >= max_count: diff --git a/gamespy_qr_server.py b/gamespy_qr_server.py index e0806fe..8e57721 100644 --- a/gamespy_qr_server.py +++ b/gamespy_qr_server.py @@ -383,7 +383,7 @@ class GameSpyQRServer(object): for session_id in self.sessions: now = int(time.time()) delta = now - self.sessions[session_id].keepalive - timeout = 60 # Remove clients that haven't responded in 60 seconds + timeout = 60 * 5 # Remove clients that haven't responded in x seconds if delta < 0 or delta >= timeout: pruned.append(session_id)