Tried to match original server's return values

The original server returns uppercase only in these areas it seems, so
emulate that.
This commit is contained in:
polaris
2014-04-18 15:56:42 -04:00
parent 0d8b585b52
commit 43e2e1b89e
3 changed files with 4 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ class Gamestats(LineReceiver):
self.log(logging.INFO, "Received connection from %s:%d" % (self.address.host, self.address.port))
# Generate a random challenge string
self.challenge = utils.generate_random_str(10)
self.challenge = utils.generate_random_str(10, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# The first command sent to the client is always a login challenge containing the server challenge key.
msg_d = []

View File

@@ -92,7 +92,7 @@ class PlayerSession(LineReceiver):
self.session = ""
# Generate a random challenge string
self.challenge = utils.generate_random_str(8)
self.challenge = utils.generate_random_str(8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# The first command sent to the client is always a login challenge containing the server challenge key.
msg_d = []

View File

@@ -1,8 +1,8 @@
import random
import logging
def generate_random_str(len):
return ''.join(random.choice("abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890") for _ in range(len))
def generate_random_str(len, set = "abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"):
return ''.join(random.choice(set) for _ in range(len))
def generate_random_number_str(len):
return ''.join(random.choice("1234567890") for _ in range(len))