FORUMS
Remove All Ads from XDA

[TOOL] yaffs extractor, mmssms.db & contacts2.db converter

5 posts
Thanks Meter: 36
 
By abbot2, Junior Member on 6th April 2012, 09:07 PM
Post Reply Email Thread
Some time ago I sold my old android phone and forgot to make a backup of SMS messages and call logs, but kept a complete image backup made by clockworkmod recovery (system.img, data.img, etc.). I wanted to import my SMS messages and call logs to a new phone, but without a reasonable backup this seemed to be impossible. Some quick search over the internet showed that a question about extracting/importing SMS messages from mmssms.db is not so uncommon, but there are no tools to do this. So I wrote one, and decided to share

Sources are available at github.com abbot/android-restore-tools.
It requires Python 2.6 and above to run.

I've also made compiled binaries for windows, attached to this post.

[Binaries last updated on 12.04.2011]
Attached Files
File Type: zip yaffs-mmssmsdb-calls-extractor.zip - [Click for QR Code] (2.20 MB, 23602 views)
The Following 31 Users Say Thank You to abbot2 For This Useful Post: [ View ] Gift abbot2 Ad-Free
 
 
7th April 2012, 06:31 AM |#2  
jamestts's Avatar
Senior Member
Flag Kuching
Thanks Meter: 51
 
More
Thanks for the tools. Nice work.

Sent from my GT-I8150 using XDA
11th April 2012, 05:08 PM |#3  
dcarr622's Avatar
Senior Member
Thanks Meter: 143
 
More
Hello,

I'm trying to use your tool to extract SMS from a nandroid backup.

I'm using the data.yaffs2.img file from the backup.

When I choose #2 for mmssms.db and then "s" to extract SMS I get the following error:

Failed to extract messages: file is encrypted or is not a database
DatabaseError('file is encrypted or is not a database',)
Warning: failed to remove temporary file...


What does this mean, and is there a solution?
11th April 2012, 05:56 PM |#4  
OP Junior Member
Flag Moscow
Thanks Meter: 36
 
Donate to Me
More
Hi,

This may be caused by two things: either my tool can't properly read/extract the image file, or it can't read the database.

Please try to extract the image (extract -x data.yaffs2.img). If this does not produce any errors, find the mmssms.db file in the extracted data, it will probably be in data/com.android.providers.telephony/databases/mmssms.db. Then try to run extract -s mmssms.db. Please post if you get any errors doing these steps.
The Following 2 Users Say Thank You to abbot2 For This Useful Post: [ View ] Gift abbot2 Ad-Free
11th April 2012, 06:16 PM |#5  
dcarr622's Avatar
Senior Member
Thanks Meter: 143
 
More
There was an error while extracting the image...it got through partway, but then failed at some bluetooth directory with colons in the path.

So I used a different tool to extract it, which went successfully.

Then I ran extract -s mmssms.db which came with the same error.

I'm pretty sure there isn't some weird encryption since I opened it up with Notepad ++ and I could read bits and pieces of conversations.

Anything else to try?
11th April 2012, 08:59 PM |#6  
OP Junior Member
Flag Moscow
Thanks Meter: 36
 
Donate to Me
More
This might be caused by an older sqlite3 version bundled with binaries. I have updated the binaries in the first message to a newer version, could you download it and try again, extract -s mmssms.db?
The Following User Says Thank You to abbot2 For This Useful Post: [ View ] Gift abbot2 Ad-Free
11th April 2012, 09:05 PM |#7  
dcarr622's Avatar
Senior Member
Thanks Meter: 143
 
More
Different error this time:

Failed to extract messages: no such column: failure_cause
OperationalError('no such column: failure_cause',)
Warning: failed to remove temporary file...


FYI the first thing at the top of the file when I open in Notepad++ is SQLite format 3 and this is from an HTC device running Android 4.x does that help at all?
11th April 2012, 09:13 PM |#8  
OP Junior Member
Flag Moscow
Thanks Meter: 36
 
Donate to Me
More
This is much better and now makes sense: android 4.0 usually has sqlite 3.7.x, previous binary build of this tool had sqlite 3.6.21, and that was the reason for the 'file is encrypted or is not a database' error.

Now it looks like mmssms.db format in Android 4.0 has changed a little bit. I will have a look on these changes and update the app accordingly. Hope it will not take too much time
The Following 2 Users Say Thank You to abbot2 For This Useful Post: [ View ] Gift abbot2 Ad-Free
11th April 2012, 09:15 PM |#9  
dcarr622's Avatar
Senior Member
Thanks Meter: 143
 
More
Quote:
Originally Posted by abbot2

This is much better and now makes sense: android 4.0 usually has sqlite 3.7.x, previous binary build of this tool had sqlite 3.6.21, and that was the reason for the 'file is encrypted or is not a database' error.

Now it looks like mmssms.db format in Android 4.0 has changed a little bit. I will have a look on these changes and update the app accordingly. Hope it will not take too much time

That would be awesome, perhaps keep the old version available for other folks too though :P

If you can get this working I'll be sure to send a couple bucks your way. Thanks!
11th April 2012, 09:50 PM |#10  
OP Junior Member
Flag Moscow
Thanks Meter: 36
 
Donate to Me
More
I have updated the extractor again, did some limited testing with android 4.0.3 on the emulator - seems to work. This database has a number of fields removed on android 4 compared to android 2, however everything required for xml dump is still there - just had to remove some unused stuff. Download the new version and try again.

Regarding the older versions, no reason to keep them - new one works fine with old database formats.
12th April 2012, 02:46 AM |#11  
dcarr622's Avatar
Senior Member
Thanks Meter: 143
 
More
Awesome works perfectly! Send me a PM where to donate.

Sent from my GT-I9000 using xda premium
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes