Slightly jank fix to deal with extra data after json dict.

Even though the dict decodes just fine, I'm having some cases where
there is additional data after it. The data looks like random junk
bytes.
This commit is contained in:
Ethan Dalool 2020-10-01 11:21:32 -07:00
parent 5a2f14b312
commit 2ad6024ad8

View file

@ -86,6 +86,8 @@ def decrypt_attr(attr, key):
attr = aes_cbc_decrypt(attr, a32_to_str(key))
attr = makestring(attr)
attr = attr.rstrip('\0')
if '"}\0' in attr:
attr = attr.split('"}\0')[0] + '"}'
return json.loads(attr[4:]) if attr[:6] == 'MEGA{"' else False
def a32_to_str(a):