This script will extract email message bodies from the SQLite database stored in an android phone.
The gmail database is typically located on your phone under the following location:
To use the script, copy the file above from your phone to your machine and rename it to
NOTE: You need a rooted phone in order to get access to the folder above.
Python, 21 lines
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import sqlite3 import zlib good_chars=',.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~ ' conn = sqlite3.connect('gmail.db') cursor = conn.cursor() cursor.execute("select _id, fromAddress, subject, bodyCompressed from messages") rows = cursor.fetchall() for row in rows: fname = (str(row) + row + row)[:48] fname = ''.join([c for c in fname if c in good_chars]) print fname with open(fname + '.html', 'wb') as fout: if row: data = zlib.decompress(row) fout.write('<html><body>' + data + '</body></html>') cursor.close() conn.close()
What type of compression is the data stored in ? I've been trying to decompress this in C# with any success .. you have 1 line of code for decompression "data = zlib.decompress(row)"
I'm at 15 lines of code now without success.. Keeps telling me that the data is corrupt but the app opens the data fine..