mirror of
https://github.com/barronwaffles/dwc_network_server_emulator.git
synced 2026-08-25 03:55:53 -05:00
Fixed: Format string vulnerabilities
This commit is contained in:
@@ -252,8 +252,10 @@ class Session(LineReceiver):
|
||||
self.transport.write(bytes(output_enc))
|
||||
|
||||
self.log(logging.DEBUG,
|
||||
"%s",
|
||||
"Responding with own IP and game port...")
|
||||
self.log(logging.DEBUG,
|
||||
"%s",
|
||||
utils.pretty_print_hex(output))
|
||||
else:
|
||||
self.find_server(query_game, filter, fields,
|
||||
@@ -272,6 +274,7 @@ class Session(LineReceiver):
|
||||
self.address.host, self.address.port,
|
||||
dest_addr, dest_port, packet_len)
|
||||
self.log(logging.DEBUG,
|
||||
"%s",
|
||||
utils.pretty_print_hex(bytearray(packet)))
|
||||
|
||||
if packet_len == len(packet):
|
||||
@@ -279,6 +282,7 @@ class Session(LineReceiver):
|
||||
self.forward_data_to_client(packet[9:], dest)
|
||||
else:
|
||||
self.log(logging.ERROR,
|
||||
"%s",
|
||||
"ERROR: Could not find entire packet.")
|
||||
|
||||
elif packet[2] == '\x03': # Keep alive reply
|
||||
@@ -292,6 +296,7 @@ class Session(LineReceiver):
|
||||
ord(packet[2]),
|
||||
self.address.host, self.address.port)
|
||||
self.log(logging.DEBUG,
|
||||
"%s",
|
||||
utils.pretty_print_hex(bytearray(packet)))
|
||||
except:
|
||||
self.log(logging.ERROR,
|
||||
@@ -325,7 +330,7 @@ class Session(LineReceiver):
|
||||
self.log(logging.WARNING,
|
||||
"key_count[%d] != len(fields)[%d]",
|
||||
key_count, len(fields))
|
||||
self.log(logging.WARNING, fields)
|
||||
self.log(logging.WARNING, "%s", fields)
|
||||
|
||||
# Write the fields
|
||||
for field in fields:
|
||||
@@ -403,7 +408,7 @@ class Session(LineReceiver):
|
||||
self.log(logging.DEBUG,
|
||||
"Sent server list message to %s:%s...",
|
||||
self.address.host, self.address.port)
|
||||
self.log(logging.DEBUG, utils.pretty_print_hex(data))
|
||||
self.log(logging.DEBUG, "%s", utils.pretty_print_hex(data))
|
||||
|
||||
# Encrypt data
|
||||
enc = gs_utils.EncTypeX()
|
||||
@@ -425,8 +430,8 @@ class Session(LineReceiver):
|
||||
query_game, filter, fields, max_servers
|
||||
)._getvalue()
|
||||
|
||||
self.log(logging.DEBUG, "Found server(s):")
|
||||
self.log(logging.DEBUG, self.server_list)
|
||||
self.log(logging.DEBUG, "%s", "Found server(s):")
|
||||
self.log(logging.DEBUG, "%s", self.server_list)
|
||||
|
||||
if not self.server_list:
|
||||
self.server_list = [{}]
|
||||
@@ -502,12 +507,12 @@ class Session(LineReceiver):
|
||||
self.log(logging.DEBUG,
|
||||
"Trying to send message to %s:%d...",
|
||||
forward_client[0], forward_client[1])
|
||||
self.log(logging.DEBUG, utils.pretty_print_hex(bytearray(data)))
|
||||
self.log(logging.DEBUG, "%s", utils.pretty_print_hex(bytearray(data)))
|
||||
|
||||
if server is None:
|
||||
return
|
||||
|
||||
self.log(logging.DEBUG, "%s %s" % (ip, server['publicip']))
|
||||
self.log(logging.DEBUG, "%s %s", ip, server['publicip'])
|
||||
if server['publicip'] == ip and \
|
||||
server['publicport'] == str(forward_client[1]):
|
||||
if forward_client[1] == 0 and 'localport' in server:
|
||||
|
||||
@@ -141,7 +141,7 @@ class InternalStatsServer(object):
|
||||
self.server_list = self.server_manager.get_server_list() \
|
||||
._getvalue()
|
||||
|
||||
logger.log(logging.DEBUG, self.server_list)
|
||||
logger.log(logging.DEBUG, "%s", self.server_list)
|
||||
|
||||
return self.server_list
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
if self.path == "/ac":
|
||||
logger.log(logging.DEBUG, "Request to %s from %s",
|
||||
self.path, client_address)
|
||||
logger.log(logging.DEBUG, post)
|
||||
logger.log(logging.DEBUG, "%s", post)
|
||||
ret = {
|
||||
"datetime": time.strftime("%Y%m%d%H%M%S"),
|
||||
"retry": "0"
|
||||
@@ -161,7 +161,7 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
logger.log(logging.DEBUG,
|
||||
"acctcreate response to %s",
|
||||
client_address)
|
||||
logger.log(logging.DEBUG, ret)
|
||||
logger.log(logging.DEBUG, "%s", ret)
|
||||
|
||||
ret = self.dict_to_str(ret)
|
||||
|
||||
@@ -211,7 +211,7 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
|
||||
logger.log(logging.DEBUG, "login response to %s",
|
||||
client_address)
|
||||
logger.log(logging.DEBUG, ret)
|
||||
logger.log(logging.DEBUG, "%s", ret)
|
||||
|
||||
ret = self.dict_to_str(ret)
|
||||
|
||||
@@ -247,7 +247,7 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
|
||||
logger.log(logging.DEBUG, "svcloc response to %s",
|
||||
client_address)
|
||||
logger.log(logging.DEBUG, ret)
|
||||
logger.log(logging.DEBUG, "%s", ret)
|
||||
|
||||
ret = self.dict_to_str(ret)
|
||||
else:
|
||||
@@ -258,7 +258,7 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
elif self.path == "/pr":
|
||||
logger.log(logging.DEBUG, "Request to %s from %s",
|
||||
self.path, client_address)
|
||||
logger.log(logging.DEBUG, post)
|
||||
logger.log(logging.DEBUG, "%s", post)
|
||||
words = len(post["words"].split('\t'))
|
||||
wordsret = "0" * words
|
||||
ret = {
|
||||
@@ -275,14 +275,14 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
self.send_header("NODE", "wifiappe1")
|
||||
|
||||
logger.log(logging.DEBUG, "pr response to %s", client_address)
|
||||
logger.log(logging.DEBUG, ret)
|
||||
logger.log(logging.DEBUG, "%s", ret)
|
||||
|
||||
ret = self.dict_to_str(ret)
|
||||
|
||||
elif self.path == "/download":
|
||||
logger.log(logging.DEBUG, "Request to %s from %s",
|
||||
self.path, client_address)
|
||||
logger.log(logging.DEBUG, post)
|
||||
logger.log(logging.DEBUG, "%s", post)
|
||||
|
||||
action = post["action"]
|
||||
|
||||
@@ -404,7 +404,7 @@ class NasHTTPServerHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||
client_address)
|
||||
|
||||
# if dlc_contenttype is False:
|
||||
# logger.log(logging.DEBUG, ret)
|
||||
# logger.log(logging.DEBUG, "%s", ret)
|
||||
else:
|
||||
self.send_response(404)
|
||||
logger.log(logging.WARNING,
|
||||
|
||||
Reference in New Issue
Block a user