Home
IPhone SMS To Gmail
Consulting
Security Alerts
Blog
Software
Projects
Links
About
Contact
Blog
FriendFeed
Facebook
Flickr
Twitter
Toluu
Last.fm
Picasa
LinkedIn
|
<< Back To All Blogs
Reading IPhone Text Messages using C# and SQLite
Friday, September 18th, 2009
As a much more interesting follow up post to my previous post I thought it would be interesting to share my method of accessing IPhone text messages using C# and SQLite.
This is not a "live" method of accessing the text messages, in that it requires that your IPhone be synced using iTunes to get the latest backup of your IPhone. When the backup is completed it backs up all data from your phone's databases, which are based upon SQLite.
After doing some digging through the SQLite databases I found the text messages table, and without further ado, I would like to present how I am reading the text messages from my IPhone:
// The MD5 names always appear to be the same, but if not, you can easily use my previous post, iterate all the files in the Backup directory, and
// then read the text messages based on searching for the proper SQLite database
string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\Apple Computer\MobileSync\Backup\99d264810a1a5d5c6de1030dcd2dc6674a8817da";
SQLiteConnection conn = new SQLiteConnection("data source=" + path + "\3d0d7e5fb2ce288813306e4d4636395e047a3d28.mddata");
SQLiteCommand comm = new SQLiteCommand("SELECT * FROM message", conn);
conn.Open();
SQLiteDataReader reader = comm.ExecuteReader();
while (reader.Read())
{
DateTime UnixBase = new DateTime(1970, 1, 1, 0, 0, 0, 0);
// The timestamp is based on UNIX Epoch, so this will get you the current date and time
DateTime timeStamp = UnixBase.AddSeconds(Int32.Parse(reader["date"].ToString()));
// The address of the sender
string from = reader["address"].ToString();
// The actual "text" of the message
string text = reader["text"].ToString();
// The ID of the message
string id = reader["ROWID"].ToString();
}
Hopefully that will help some of you nerds out there trying to take your IPhonedness to the next level.
SMSin' Tom Out.
Tags
IPhone
CSharp
SQLite
Howto
Related Blogs
Backing up your IPhone SMS Messages to Gmail and Google Apps
No More IPhone for Me
Writing console output from a Windows form in C#
Autostarting a Windows Service directly after install in C#
ASP.NET Best Practices
Comments
Currently no comments.
Add A Comment
Name:
URL:
Email Address: (not public, used to send notifications on further comments)
Comments:
Please enter the text from the image:

|