Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,778,373 Members 47,823 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
abbot2
Old
(Last edited by abbot2; 11th April 2012 at 09:42 PM.) Reason: updated binaries
#1  
Junior Member - OP
Thanks Meter 27
Posts: 5
Join Date: Apr 2012
Location: Moscow

 
DONATE TO ME
Cool [TOOL] yaffs extractor, mmssms.db & contacts2.db converter

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, 7242 views)
The Following 23 Users Say Thank You to abbot2 For This Useful Post: [ Click to Expand ]
 
jamestts
Old
#2  
jamestts's Avatar
Senior Member
Thanks Meter 51
Posts: 148
Join Date: Mar 2011
Location: Kuching
Thanks for the tools. Nice work.

Sent from my GT-I8150 using XDA
 
dcarr622
Old
#3  
dcarr622's Avatar
Senior Member
Thanks Meter 142
Posts: 1,613
Join Date: Oct 2008
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?
  • Google Glass - #TeamShale
  • Nexus 5 - White - 16GB
  • Nexus 7 - White - Google I/O Edition
  • HP TouchPad 32GB
LG Optimus G E970, Galaxy Nexus GSM, HTC HD2 T9193, Samsung Galaxy S I9000M 'Bell Vibrant', HTC Tilt
 
abbot2
Old
#4  
Junior Member - OP
Thanks Meter 27
Posts: 5
Join Date: Apr 2012
Location: Moscow

 
DONATE TO ME
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 User Says Thank You to abbot2 For This Useful Post: [ Click to Expand ]
 
dcarr622
Old
#5  
dcarr622's Avatar
Senior Member
Thanks Meter 142
Posts: 1,613
Join Date: Oct 2008
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?
  • Google Glass - #TeamShale
  • Nexus 5 - White - 16GB
  • Nexus 7 - White - Google I/O Edition
  • HP TouchPad 32GB
LG Optimus G E970, Galaxy Nexus GSM, HTC HD2 T9193, Samsung Galaxy S I9000M 'Bell Vibrant', HTC Tilt
 
abbot2
Old
#6  
Junior Member - OP
Thanks Meter 27
Posts: 5
Join Date: Apr 2012
Location: Moscow

 
DONATE TO ME
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: [ Click to Expand ]
 
dcarr622
Old
#7  
dcarr622's Avatar
Senior Member
Thanks Meter 142
Posts: 1,613
Join Date: Oct 2008
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?
  • Google Glass - #TeamShale
  • Nexus 5 - White - 16GB
  • Nexus 7 - White - Google I/O Edition
  • HP TouchPad 32GB
LG Optimus G E970, Galaxy Nexus GSM, HTC HD2 T9193, Samsung Galaxy S I9000M 'Bell Vibrant', HTC Tilt
 
abbot2
Old
#8  
Junior Member - OP
Thanks Meter 27
Posts: 5
Join Date: Apr 2012
Location: Moscow

 
DONATE TO ME
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: [ Click to Expand ]
 
dcarr622
Old
#9  
dcarr622's Avatar
Senior Member
Thanks Meter 142
Posts: 1,613
Join Date: Oct 2008
Quote:
Originally Posted by abbot2 View Post
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!
  • Google Glass - #TeamShale
  • Nexus 5 - White - 16GB
  • Nexus 7 - White - Google I/O Edition
  • HP TouchPad 32GB
LG Optimus G E970, Galaxy Nexus GSM, HTC HD2 T9193, Samsung Galaxy S I9000M 'Bell Vibrant', HTC Tilt
 
abbot2
Old
#10  
Junior Member - OP
Thanks Meter 27
Posts: 5
Join Date: Apr 2012
Location: Moscow

 
DONATE TO ME
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.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes