3
2
forked from Dniel97/artemis

pokken: fix mucha and allnet info, fix allnet 2.00 format requests

This commit is contained in:
Hay1tsme 2023-03-10 20:31:29 -05:00
parent f283dd10a9
commit 2dd84bbe3e
4 changed files with 17 additions and 21 deletions

View File

@ -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"))

View File

@ -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)}")

View File

@ -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"]),
)

View File

@ -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")