forked from Dniel97/artemis
billing: handle malformed requests
This commit is contained in:
parent
8d94d25893
commit
7bb8c2c80c
@ -249,6 +249,7 @@ class AllnetServlet:
|
|||||||
signer = PKCS1_v1_5.new(rsa)
|
signer = PKCS1_v1_5.new(rsa)
|
||||||
digest = SHA.new()
|
digest = SHA.new()
|
||||||
|
|
||||||
|
try:
|
||||||
kc_playlimit = int(req_dict[0]["playlimit"])
|
kc_playlimit = int(req_dict[0]["playlimit"])
|
||||||
kc_nearfull = int(req_dict[0]["nearfull"])
|
kc_nearfull = int(req_dict[0]["nearfull"])
|
||||||
kc_billigtype = int(req_dict[0]["billingtype"])
|
kc_billigtype = int(req_dict[0]["billingtype"])
|
||||||
@ -258,6 +259,9 @@ class AllnetServlet:
|
|||||||
kc_date = strptime(req_dict[0]["date"], "%Y%m%d%H%M%S")
|
kc_date = strptime(req_dict[0]["date"], "%Y%m%d%H%M%S")
|
||||||
kc_serial_bytes = kc_serial.encode()
|
kc_serial_bytes = kc_serial.encode()
|
||||||
|
|
||||||
|
except KeyError as e:
|
||||||
|
return f"result=5&linelimit=&message={e} field is missing".encode()
|
||||||
|
|
||||||
machine = self.data.arcade.get_machine(kc_serial)
|
machine = self.data.arcade.get_machine(kc_serial)
|
||||||
if machine is None and not self.config.server.allow_unregistered_serials:
|
if machine is None and not self.config.server.allow_unregistered_serials:
|
||||||
msg = f"Unrecognised serial {kc_serial} attempted billing checkin from {request_ip} for game {kc_game}."
|
msg = f"Unrecognised serial {kc_serial} attempted billing checkin from {request_ip} for game {kc_game}."
|
||||||
|
Loading…
Reference in New Issue
Block a user