Digging deep to recover messages
Recipe Difficulty: Hard
Python Version: 3.5
Operating System: Any
Earlier in this chapter, we developed a recipe to identify missing records from a database. In this recipe, we will leverage the output from that recipe and identify recoverable records and their offset within a database. This is accomplished by understanding some internals of SQLite databases and leveraging that understanding to our advantage.
Note
For a detailed description of the SQLite file internals, review https://www.sqlite.org/fileformat.html.
With this technique, we will be able to quickly triage a database and identify recoverable messages.
When a row from a database is deleted, similar to a file, the entry is not necessarily overwritten. This entry can still persist for some time based on database activity and its allocation algorithms. Our chances for data recovery decrease when, for example, a vacuum
command is triggered.
We will not get into the weeds discussing SQLite structure; suffice...