The past few days, I've returned to playing around with backup files. Among other things, I discovered that the name of each backup file is actually the SHA1 hash of its path. So there really is a logic between the mdbackup naming and the files they represent!
I also started creating custom manifests with the idea that I'd love to be able to return customized files to the iPhone. In this, I experienced both success and failure. The success was that the Manifest uses simple SHA1 signing. You can easily strip a manifest of its extraneous applications and files and re-embed that stripped manifest into the Manifest.plist file and restore just that subset. Here are the steps:
1. Create a new working directory in ~/Library/Application Support/MobileSync/Backups.
2. Copy the Manifest.plist file and the mdbackups you want to restore into the working directory.
3. Read in the @"Data" item from Manifest.plist and deserialize it to a dictionary. Remove all the items in the @"Applications" subdictionary and everything but the specific mdbackup files you want to use from the @"Files" subdictionary.
4. Reserialize the updated dictionary, add it back into the Manifest @"Data" and sign the reserialzed data with SHA1.
5. Perform a restore using --source as the working directory. Only the selected files will transfer to the iPhone.
Far less easy unfortunately, is trying to build a manifest with updated file data. Each file must be signed with a @"DataHash". This is a 20 byte item that is not SHA1. I've messed with SHA, SHA1, MD5 and an assortment of other approaches but haven't yet been able to crack it. The Manifest stores the data hash along with the file length and permissions data. These entries must be correct for the file to restore properly. I've been testing against already-hashed files to try to duplicate those hashes.
Although embedding new data into mdbackup files is easy (see part 4 of my iPhone Backups series), getting these values right is not and I have yet to figure them out. If you'd like to give things a spin or have some suggestions for me, let me know in the comments.
Good luck! Perhaps if someone like you can figure this out, we can finally get a decent add-on program where we can edit notes... on both sides of the screen.
I can´t find Iphone Backups part 4, where is it?
http://blogs.oreilly.com/digitalmedia/2008/05/iphone-backups-part-4.html
Erica,
I am in desperate need to recover a deleted iPhone Backup file (just tonight). If you know of any tricks, utilities, data recovery tools or just any way to recover anything from my hard drive, I would be willing to PAY MONEY to get this data recovered! iTunes deleted the WRONG Backup, and now I have lost EVERYTHING (as I was doing it after a fresh iPhone restore due to problems)!
Please help or else I will be subject to losing a year's worth of productivity! I have a lot of free space on my drive so I'm hoping I can recover at least some mdbackup files to extract the data -- I need my NOTES, at the very least! Time Machine does not backup the Backup folder!
I've just come across this post and I'd like to know if it's possible to restore from an iPhone-Backup directory just the parts I need (like SMS and notes, for example)...
Any help would be appreciated!
Keep on guys!
This is all well and good ... but what about those of use who don't have MACs but just a plain old Windows-based PC? How do we access the information in the mdbackup files though the info and manifest plists? How do we decompress the mdbackup files so we can retain the information on our PC in a readable format?
Thanks!
Erica Sadun said:
http://blogs.oreilly.com/digitalmedia/2008/05/iphone-backups-part-4.html
July 27, 2008 12:53 PM
but there is only the first paragraph of that article - with a link to the whole article which links to itself again!
The full article is missing!
Hi Marc, thanks for pointing that out. I'll fix that circular link. Here's where the article actually is: http://blogs.oreilly.com/iphone/2008/06/iphone-backups-part-4.html
Hi Erica, would it be possible for you to create the script to do the steps 1-5 that you stated in this post? Like Chris, I have some photos I'm trying to recover from the backup files. Unfortunately for me, the manifest file in the backup directory is corrupt or does not match my backup file list. So, I'm looking for a way to reconstruct the manifest file with the actual photo backup files in my directory. thanks!
Great work Erica.
A first step tool that would help a lot of people would not have to worry about the DataHash. A simple backup utility for the iPhone that stores past backups and their diffs, then if you want to restore a bunch of old notes you restore the entire notes.db from the old backup. Only problem is you get the notes from then and lose the notes from now.
And I played with what that 20byte hash is, no clue.
Desperate for a backup extraction tool that works on the latest leopard. i've to to rescue critical bookmarks overwritten by the mobileme system.
help GREATLY appreciated!
The tool is still there -- but I recompiled it as a universal binary.
http://ericasadun.com/ftp/Macintosh
Erika please
i backed up my notes by 176
and kept on writing till i was by 183
Then i restaured them trying to do whatever!
Where can i g'et the deleted ones?
thanx
Erica.... I LOVE YOU!!
You may not believe it but you saved my butt. Thank you so much for putting that easy to use, recompiled md extractor up. I got back my bookmarks.
Sadly threw away some old backups not using my head that I'd need them so with tons of iPhone crashing, lost many SMS and call logs, but this file I needed desperately.
G
hi erika,
on editing mdbackup files, the call history file a49bfab36504be1bf563c1d1813b05efd6076717.mdbackup includes the 100 calls limit... assuming calls past 100 are stored somewhere in the iphone,
i am wondering if editing the mdbackup file 100 limit into say 200 then restoring into the iphone would allow me to retrieve these calls past 100 ... cheers
C