3
2
forked from Dniel97/artemis

mai2: add check for Mai-Encoding headers

This commit is contained in:
Hay1tsme 2023-08-01 02:34:40 -04:00
parent 23bcb5cc13
commit 757fdc5c57

View File

@ -181,11 +181,14 @@ class Mai2Servlet:
elif version >= 197: # Finale elif version >= 197: # Finale
internal_ver = Mai2Constants.VER_MAIMAI_FINALE internal_ver = Mai2Constants.VER_MAIMAI_FINALE
if all(c in string.hexdigits for c in endpoint) and len(endpoint) == 32: if request.getHeader('Mai-Encoding') is not None or request.getHeader('X-Mai-Encoding') is not None:
# If we get a 32 character long hex string, it's a hash and we're # The has is some flavor of MD5 of the endpoint with a constant bolted onto the end of it.
# doing encrypted. The likelyhood of false positives is low but # See cake.dll's Obfuscator function for details. Hopefully most DLL edits will remove
# technically not 0 # these two(?) headers to not cause issues, but given the general quality of SEGA data...
self.logger.error("Encryption not supported at this time") enc_ver = request.getHeader('Mai-Encoding')
if enc_ver is None:
enc_ver = request.getHeader('X-Mai-Encoding')
self.logger.debug(f"Encryption v{enc_ver} - User-Agent: {request.getHeader('User-Agent')}")
try: try:
unzip = zlib.decompress(req_raw) unzip = zlib.decompress(req_raw)