Extract your sms, notes, call history, Calendar, Address Book and Contact Images DBs from local iPhone backup

127 views
Skip to first unread message

mrflip

unread,
Jul 10, 2007, 1:11:21 PM7/10/07
to iPhoneWebDev
James Duncan Davidson points out that the iPhone backup files are
munged SQLite 3 files:
http://duncandavidson.com/archives/472

I wrote a script to extract and name the various DBs. The files all
load just fine in SQLite Database Browser:
http://sqlitebrowser.sourceforge.net/
The script is here:
http://groups.google.com/group/iphonewebdev/web/bkupextract.pl

The cal and addressbook DBs are uninteresting, but the notes, sms and
call history files don't yet interact with things. Pulling notes into
the Stickies app, or making iPhoney display the iPhone-specific info,
might be interesting ideas.

flip

AwayBBL

unread,
Jul 10, 2007, 8:31:24 PM7/10/07
to iPhoneWebDev
Hmmm... looking at the way the data is stored for that guys notes, it
looks like the Notes application uses the webkit to display its
text...

I wonder... hmmm... couldn't someone build an app that they would give
to a user to "import" into their notes database, and then have the app
run within the notes app. Wish I was brave enough to try.

Michael Latta

unread,
Jul 10, 2007, 9:19:53 PM7/10/07
to iphone...@googlegroups.com
My question is how do you restore from the backups? I can not find
an option in iTunes to restore to the last backup, or better yet to a
selected backup.

Does it backup every time it is synced? Do you only have the latest
one? That is effectively only a help for hardware failure, not file
corruption.

Michael

mrflip

unread,
Jul 10, 2007, 10:15:53 PM7/10/07
to iPhoneWebDev
This guy's implementation is ~100,000 times better (inasmuch as it
works with the actual files, instead of hack hack kludge like my perl
script above):
http://code.google.com/p/iphone-backup-decoder/
Note that his script DOES DESTRUCTIVELY MODIFY its input, so *don't*
run it directly on your ~/Library... files.

The .plist files are just standard binary plists, as it turns out,
which can be converted with the "plutil":
plutil -convert xml1 plist_filename.mdbackup

I think the backup is restored if you do a full reset of iPhone:
http://www.tech-recipes.com/rx/2489/iphone_hard_reset
but... um... maybe check around before you do this.

so, yeah, if you *really* wanted to cram some stuff into Notes I bet
you could un-binary the plist, inject stuff using SQLite, re-binary
the plist and then hard reset your phone. I for one will just be
treating it as read-only from the client side for now.

As for backing up when it is synced, you could write a crontab script
to make daily/weekly backups of the MobileSync directory -- or just
add it to your backup solution (http://mozy.com/)

flip

agei...@gmail.com

unread,
Jul 11, 2007, 11:16:34 PM7/11/07
to iPhoneWebDev
I hadn't yet seen this second implementation. The code on it looks
really complex. Here's the version I wrote:

http://www.uninnovate.com/2007/07/11/dear-iphone-give-me-my-data/

That link has the description and instructions. I also uploaded the
bare extract_iphone_backup.py file to the group.

Differences:
- Doesn't destructively modify anything, so you can run it on your
real files.
- Automatically extracts backups for all iPhones
- Extracts all the files, not just the sqlite databases
- In addition, it fully extracts any plist files that were stored as
"binary plists inside of binary plists" so they are easier to read and
work with.

Thanks,

Adam Geitgey

Reply all
Reply to author
Forward
0 new messages