Created
April 6, 2012 01:23
-
-
Save alexlegg/2315790 to your computer and use it in GitHub Desktop.
Read iPhone Message backup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
import sqlite3 | |
from datetime import datetime | |
conn = sqlite3.connect('backup') | |
c = conn.cursor() | |
print """ | |
<html> | |
<head> | |
<title>Message Backup</title> | |
<style text="text/css"> | |
div#container { | |
margin: auto; | |
width: 600px; | |
font-family: arial; | |
} | |
.date { | |
font-weight: bold; | |
color: grey; | |
font-size: 8pt; | |
} | |
div#container div { | |
//width: 400px; | |
} | |
.from { | |
float: left; | |
} | |
.to { | |
float: right; | |
text-align: right; | |
} | |
div.message { | |
position: relative; | |
-moz-border-radius: 10px; | |
-webkit-border-radius: 10px; | |
border-radius: 10px; | |
border: 1px solid grey; | |
padding: 5px; | |
max-width: 70%; | |
} | |
div.from { | |
background: #EBEBEB; | |
} | |
div.to { | |
//background: #D0ECCC; | |
background: #92D885; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="container">""" | |
c.execute("SELECT date, text, flags FROM message WHERE Address='+61405298675'") | |
for (date, message, flags) in c: | |
if message: | |
if flags == 3: | |
mclass = 'from' | |
else: | |
mclass = 'to' | |
print '<span class="', mclass, 'date">', datetime.fromtimestamp(date), '</span>' | |
print '<br />' | |
print '<div class="', mclass, 'message">', message.encode('ascii', 'ignore'), '</div>' | |
print '<div style="clear:both;"></br /></div>' | |
print '</div></body></html>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment