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.
master
Ethan Dalool 2020-10-01 11:21:32 -07:00
parent 5a2f14b312
commit 2ad6024ad8
1 changed files with 2 additions and 0 deletions

View File

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