From 2dd84bbe3e0da8db5f6f606b8a4d868153441180 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Fri, 10 Mar 2023 20:31:29 -0500 Subject: [PATCH] pokken: fix mucha and allnet info, fix allnet 2.00 format requests --- core/allnet.py | 12 +++--------- core/mucha.py | 2 +- index.py | 2 +- titles/pokken/index.py | 22 ++++++++++++---------- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/core/allnet.py b/core/allnet.py index 0a63e89..1b561b8 100644 --- a/core/allnet.py +++ b/core/allnet.py @@ -78,13 +78,7 @@ class AllnetServlet: req = AllnetPowerOnRequest(req_dict[0]) # Validate the request. Currently we only validate the fields we plan on using - if ( - not req.game_id - or not req.ver - or not req.token - or not req.serial - or not req.ip - ): + if not req.game_id or not req.ver or not req.serial or not req.ip: raise AllnetRequestException( f"Bad auth request params from {request_ip} - {vars(req)}" ) @@ -94,7 +88,7 @@ class AllnetServlet: self.logger.error(e) return b"" - if req.format_ver == 3: + if req.format_ver == "3": resp = AllnetPowerOnResponse3(req.token) else: resp = AllnetPowerOnResponse2() @@ -354,7 +348,7 @@ class AllnetPowerOnRequest: self.boot_ver: str = req.get("boot_ver", "") self.encode: str = req.get("encode", "") self.hops = int(req.get("hops", "0")) - self.format_ver = int(req.get("format_ver", "2")) + self.format_ver = req.get("format_ver", "2") self.token = int(req.get("token", "0")) diff --git a/core/mucha.py b/core/mucha.py index e058b12..9505282 100644 --- a/core/mucha.py +++ b/core/mucha.py @@ -71,7 +71,7 @@ class MuchaServlet: # TODO: Decrypt S/N resp = MuchaAuthResponse( - f"{self.config.mucha.hostname}{':' + self.config.mucha.port if self.config.server.is_develop else ''}" + f"{self.config.mucha.hostname}{':' + str(self.config.mucha.port) if self.config.server.is_develop else ''}" ) self.logger.debug(f"Mucha response {vars(resp)}") diff --git a/index.py b/index.py index fba6d11..5b8d92b 100644 --- a/index.py +++ b/index.py @@ -73,7 +73,7 @@ class HttpDispatcher(resource.Resource): "mucha_updatacheck", "/mucha/updatacheck.do", controller="mucha", - action="handle_updatacheck", + action="handle_updatecheck", conditions=dict(method=["POST"]), ) diff --git a/titles/pokken/index.py b/titles/pokken/index.py index 047989b..6efbf90 100644 --- a/titles/pokken/index.py +++ b/titles/pokken/index.py @@ -65,17 +65,17 @@ class PokkenServlet(resource.Resource): if not game_cfg.server.enable: return (False, "", "") - if core_cfg.server.is_develop: - return ( - True, - f"https://{game_cfg.server.hostname}:{game_cfg.server.port}/{game_code}/$v/", - f"{game_cfg.server.hostname}:{game_cfg.server.port}/", - ) + # if core_cfg.server.is_develop: + # return ( + # True, + # f"https://{game_cfg.server.hostname}:{game_cfg.server.port}/{game_code}/$v/", + # f"{game_cfg.server.hostname}:{game_cfg.server.port}/", + # ) return ( True, - f"https://{game_cfg.server.hostname}/{game_code}/$v/", - f"{game_cfg.server.hostname}/", + f"https://{game_cfg.server.hostname}:443/{game_code}/$v/", + f"{game_cfg.server.hostname}/SDAK/$v/", ) @classmethod @@ -92,7 +92,7 @@ class PokkenServlet(resource.Resource): if not game_cfg.server.enable: return (False, "") - return (True, "PKFN") + return (True, "PKF2") def setup(self): """ @@ -143,7 +143,9 @@ class PokkenServlet(resource.Resource): self.logger.warn(f"{e} {content}") return b"" - endpoint = jackal_pb2.MessageType(pokken_request.type).name.lower() + endpoint = jackal_pb2.MessageType.DESCRIPTOR.values_by_number[ + pokken_request.type + ].name.lower() self.logger.info(f"{endpoint} request")