Handle cases where Manifest.db's reported size doesn't match #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed the discrepancies while trying to create a re-encrypted backup, based on files decrypted with MVT. I haven't seen any pattern for when Manifest.db sizes are wrong, or even whether those sizes are reliable; the end-of-file AES padding seems to be the most reliable source of information.
At any rate, these changes at least guarantee consistency with the original encrypted backup. Overall logic:
truncate
, which will extend the size automatically (and turn the AES padding into part of the file)This was tested by using
pip install -e .
on a local checkout, withmvt-ios decrypt
and then a custom script to re-encrypt backups. Systems used were macOS 10.15-12 Python 3.8-3.10, and backups were for iOS 14.7-15.7.