Handling SQLite databases
Recipe Difficulty: Easy
Python Version: 3.5
Operating System: Any
As discussed, SQLite databases serve as the primary data repository on mobile devices. Python has a built-in library, sqlite3
, which can be used to interface with these databases. In this script, we will interact with the iPhone sms.db
file and extract data from the message
table. We will also use this script as an opportunity to introduce the csv
library and write the message data to a spreadsheet.
Note
To learn more about the sqlite3
library, visit https://docs.python.org/3/library/sqlite3.html.
Getting started
All libraries used in this script are present in Python's standard library. For this script, make sure to have an sms.db
file from which to query. With some minor modification, you can use this script with any database; however, we will specifically be talking about it with respect to the iPhone SMS database from an iOS 10.0.1 device.
How to do it...
The recipe follows these basic principles:
- Connect...