Book Image

Python Digital Forensics Cookbook

By : Chapin Bryce, Preston Miller
Book Image

Python Digital Forensics Cookbook

By: Chapin Bryce, Preston Miller

Overview of this book

Technology plays an increasingly large role in our daily lives and shows no sign of stopping. Now, more than ever, it is paramount that an investigator develops programming expertise to deal with increasingly large datasets. By leveraging the Python recipes explored throughout this book, we make the complex simple, quickly extracting relevant information from large datasets. You will explore, develop, and deploy Python code and libraries to provide meaningful results that can be immediately applied to your investigations. Throughout the Python Digital Forensics Cookbook, recipes include topics such as working with forensic evidence containers, parsing mobile and desktop operating system artifacts, extracting embedded metadata from documents and executables, and identifying indicators of compromise. You will also learn to integrate scripts with Application Program Interfaces (APIs) such as VirusTotal and PassiveTotal, and tools such as Axiom, Cellebrite, and EnCase. By the end of the book, you will have a sound understanding of Python and how you can use it to process artifacts in your investigations.
Table of Contents (11 chapters)

Identifying gaps in SQLite databases

Recipe Difficulty: Easy

Python Version: 2.7 or 3.5

Operating System: Any

This recipe will demonstrate how to programmatically identify missing entries for a given table by using its primary key. This technique allows us to identify records that are no longer active in the database. We will use this to identify which and how many messages have been deleted from an iPhone SMS database. This, however, will work with any table that uses an auto-incrementing primary key.

To learn more about SQLite tables and primary keys, visit https://www.sqlite.org/lang_createtable.html.

One fundamental idea governing SQLite databases and their tables are primary keys. A primary key is typically a column that serves as a unique integer for a particular row in the table. A common implementation is the auto-incrementing primary key, starting typically at 1 for the...