A more concrete way to determine database offset

This commit is contained in:
KnugiHK
2022-09-05 12:48:36 +08:00
parent e7c246822b
commit 2f04b69f38

View File

@@ -112,7 +112,8 @@ def decrypt_backup(database, key, output, crypt=Crypt.CRYPT14):
raise ValueError("The crypt15 file must be at least 131 bytes")
t1 = t2 = None
iv = database[8:24]
db_ciphertext = database[131:]
db_offset = database[0] + 2 # Skip protobuf + protobuf size and backup type
db_ciphertext = database[proto_len:]
if t1 != t2:
raise ValueError("The signature of key file and backup file mismatch")