Skip to content

Instantly share code, notes, and snippets.

@jsok
Created October 4, 2012 04:36
Show Gist options
  • Save jsok/3831500 to your computer and use it in GitHub Desktop.
Save jsok/3831500 to your computer and use it in GitHub Desktop.
iOS 6 SMS database dumping
Looking into how to retrieve SMS archives from iOS 6.
Useful resources:
http://lasc.livejournal.com/284909.html
To explain the datetime mangling:
"The timestamps are not traditional timestamps of the number of seconds from 1/1/1970, but are instead based on the number of seconds from 1/1/2001 (so, there is a 31 year offset). So, we have to add the number of seconds in 31 years (978264705) to the timestamp to change it to a traditional timestamp giving the number of seconds from 1/1/1970."
Query below will pull a history of all message to and from the PHONE NUMBER specified.
sqlite3 CLI app is useful here:
.mode html
.output history.html
<queries>
This will redirect all results into a html table in the specified file.
select "handle"."id", datetime("message"."date"+978264705, 'unixepoch'), "message"."text" from "message" left join "handle" ON "handle".ROWID="message".handle_id where "handle"."id" = "+61<PHONE NUMBER>" order by "message"."date";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment