mirror of
https://github.com/barronwaffles/dwc_network_server_emulator.git
synced 2026-09-09 03:35:16 -05:00
Modified NAS slightly
I was having trouble with the base64 encoded data, so I replaced it with something that should definitely work. I also reduced the size of the auth token so there won't be any possible overflows. Since it's random data it can easily be adjusted in the future if for some reason it's too small.
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import sqlite3
|
||||
import hashlib
|
||||
import itertools
|
||||
import other.utils as utils
|
||||
import time
|
||||
import logging
|
||||
|
||||
import other.utils as utils
|
||||
import gamespy.gs_utility as gs_utils
|
||||
|
||||
# Logger settings
|
||||
logger_output_to_console = True
|
||||
logger_output_to_file = True
|
||||
@@ -382,7 +384,9 @@ class GamespyDatabase(object):
|
||||
return r["data"]
|
||||
|
||||
def generate_authtoken(self, userid, data):
|
||||
size = 128
|
||||
# Since the auth token passed back to the game will be random, we can make it small enough that there
|
||||
# should never be a crash due to the size of the token.
|
||||
size = 16
|
||||
authtoken = "NDS" + utils.generate_random_str(size)
|
||||
|
||||
q = "SELECT authtoken FROM nas_logins WHERE authtoken = ?"
|
||||
@@ -412,7 +416,7 @@ class GamespyDatabase(object):
|
||||
c.execute(q, [authtoken, data, userid])
|
||||
|
||||
c.close()
|
||||
self.conn.commit();
|
||||
self.conn.commit()
|
||||
|
||||
return authtoken
|
||||
|
||||
|
||||
@@ -75,9 +75,9 @@ class NintendoNasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
logger.log(logging.DEBUG, ret)
|
||||
|
||||
for k, v in ret.iteritems():
|
||||
ret[k] = self.base64_enc(v)
|
||||
ret[k] = gs_utils.base64_encode(v)
|
||||
|
||||
self.wfile.write(urllib.urlencode(ret).replace("%2A", "*"))
|
||||
self.wfile.write(urllib.urlencode(ret))
|
||||
|
||||
#elif self.path == "/pr":
|
||||
# TODO
|
||||
|
||||
Reference in New Issue
Block a user