Book Image

Learning Python for Forensics

By : Chapin Bryce
Book Image

Learning Python for Forensics

By: Chapin Bryce

Overview of this book

This book will illustrate how and why you should learn Python to strengthen your analysis skills and efficiency as you creatively solve real-world problems through instruction-based tutorials. The tutorials use an interactive design, giving you experience of the development process so you gain a better understanding of what it means to be a forensic developer. Each chapter walks you through a forensic artifact and one or more methods to analyze the evidence. It also provides reasons why one method may be advantageous over another. We cover common digital forensics and incident response scenarios, with scripts that can be used to tackle case work in the field. Using built-in and community-sourced libraries, you will improve your problem solving skills with the addition of the Python scripting language. In addition, we provide resources for further exploration of each script so you can understand what further purposes Python can serve. With this knowledge, you can rapidly develop and deploy solutions to identify critical information and fine-tune your skill set as an examiner.
Table of Contents (24 chapters)
Learning Python for Forensics
Credits
About the Authors
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Python for OS X and Linux


Unlike Windows, Python typically comes standard with OS X and Linux. To determine what version of Python your machine is running, call the Python interpreter with the "V" switch: (case-sensitive):

LPF@ubuntu:~$ python -V
Python 2.7.9

If your machine does not have Python or is running an older version of Python, you can install it in a variety of ways.

For OS X and Linux, you can navigate to http://python.org/downloads to download the latest release of Python 2.X or 3.X for your particular system. Additionally, visiting http://python.org/downloads/mac-osx/ or python.org/downloads/source/ will allow you to download current and previous versions of Python 2.X and 3.X for OS X and Linux, respectively.

Installing Python on OS X is straightforward, simply download the installer, run it, and the specific version of Python selected will be installed on your system and added automatically to your PATH variable. Confirm by opening the Terminal, typing python, and pressing Tab twice to see available options. Depending on your system, you may have a number of different versions of Python already installed.

In addition to the methods described earlier, installing Python on Linux can typically be performed with the default package manager. As an example, using apt as a package manager, you can search for and install various Python packages.

We can search apt-cache to see available Python packages. In this case, we pipe it through more so we can view the data one page at a time.

LPF@ubuntu:-$ apt-cache search python | more
...
python2.7 - Interactive high-level object-oriented language (version 2.7)
...
python3 - interactive high-level object-oriented language (default python3 version)

We can use the apt-get package manager to handle installation of either Python 2.X or 3.X packages:

LPF@ubuntu:-$ sudo apt-get install python2.7
LPF@ubuntu:-$ sudo apt-get install python3