All Courses

Getting Started with Digital Forensics in Python

Jigisha Sata

2 years ago

Digital Forensics in Python | insideAIML
Table of Contents
  • Why Python is one of the best for Digital Forensics?
  • How to Install Python?
              1. Python Installation on Unix and Linux
              2. Python Installation on Windows
              3. Python Installation on Macintosh
  • How to Set PATH for Python manually?
              1. Path setting at Unix/Linux
              2. Path Setting at Windows
  • Running Python
             1: With the Interactive Interpreter
             2: With the Script from the Command-line
            3: Integrated Development Environment
         In this article, we will try to see how to use python programming for digital forensics investigation.
Let’s first understand

Why Python is one of the best for Digital Forensics?

          We all know how much python programming language is popular. Its popularity is not only among the professional programmer but also among the people who are new to programming and just started their career.
Python is used for cybersecurity, penetration as well as digital forensic investigations. When we use Python as a tool for digital forensics, we don’t need other third-party software for completing the task as python provides an end to end solution.
Python programming provides some of the unique features that make it a good choice for digital forensics. Some of them as listed below-
  • Syntax Simplicity – Python is considered one of the easiest programming languages in terms of its syntax as compared to other languages, that makes it easier for one to learn and also use for digital forensics.
  • Comprehensive inbuilt modules − Python provides us with a comprehensive inbuilt module which is an excellent aid. This module helps us to perform a complete digital forensic investigation.
  • Help and Support – Python is an open-source programming language with a huge user’s community of software developers worldwide that provide excellent support. 
  • Cross-platform Compatible − Python is a cross-platform compatible language which can run efficiently on various platforms such as UNIX, Windows, and Macintosh.
  • GUI Programming − Python supports for GUI (Graphical user interfaces) programming which helps developers to work with an easy interface. 
  • Integration with other programming languages – It can easily be integrated with different programming languages such as C, C++, JAVA etc.

How to install Python?

How to install Python | insideAIML
     One of the best advantages of python is that its distribution is available for different platforms such as Windows, UNIX, Linux and Mac. We need only to download the binary code as per our platform and install it.
We can also compile it manually if we have the source code and C compiler available with us.
Now let’s see the installation of Python on various platforms−

1. Python Installation on Unix and Linux

These are the steps shown below to install Python on Unix/Linux machine
  • Step 1 − Open this URL
  • Step 2 − Download the source code available for Unix/Linux which will be in zipped format. 
  • Step 3 − Extract the zipped files. 
  • Step 4 − If you wish to customize a few options according to yourself, you can edit the Modules/Setup file. 
  •  Step 5 – To complete the installation run the below-mentioned command  
run ./configure script

make install
Once the above step is completed, Python will be installed at its standard location /usr/local/bin and its libraries will be installed at /usr/local/lib/pythonXX where XX represents the version of Python installed.

2. Python Installation on Windows

Below mentioned are the simple steps to install Python on any Windows machine.
  • Step 1 – Go to this URL
  • Step 2 − Download the Windows installer python-XYZ.msi file, where XYZ is the version you want to install.
  • Step 3 – After downloading run that MSI file after saving the installer file to your local computer.
  • Step 4 – Now run the downloaded file which will bring up the Python installation wizard.

3. Python Installation on Macintosh

Python 3 is installed on Mac OS X using a package installer named Homebrew.
To install Homebrew, if you don’t have it in your mac machine run the below-mentioned command
$ ruby -e "$(curl -fsSL"
Now in case you need to update the package manager, then it can be done as follows-
$ brew update
Now, Run the below mentioned command to install Python3 on your Mac OS system −
$ brew install python3

How to Set PATH for Python manually?

          Now let’s suppose you wants to set your own path for Python installation. Note different platforms such as UNIX, WINDOWS, or MAC have their own specific process and all differ from one another.
Let’s try to see one by one separately

1. Path setting at Unix/Linux

You can follow the below mentioned points to set the path on Unix/Linux −
  •  If using csh shell - Type setenv PATH "$PATH:/usr/local/bin/python" and then press Enter.
  •  If using bash shell (Linux) − Type export ATH="$PATH:/usr/local/bin/python" and then press Enter.
  • If using sh or ksh shell - Type PATH="$PATH:/usr/local/bin/python" and then press Enter.

2. Path Setting at Windows

To set the path on windows machine type the below-mentioned code in the command prompt and then press Enter.
setx path "%path%;c:\directoryPath"
It will install the python on the mentioned path.

Running Python

Running Python | insideAIML
There are three method to start your Python interpreter as mentioned below –

Method 1: With the Interactive Interpreter

          Python can be easily be used by any system which provides a command-line interpreter or shell. For example, Unix, DOS etc.
A system that provides a command-line interpreter or shell can easily be used for starting Python. For example, Unix, DOS, etc.
To use interactive interpreter follows the below steps:
Step 1 − Write python at the command line and press enter.
Step 2 − Using the commands shown below. You can start coding
$python # Unix/Linux
python% # Unix/Linux
C:> python # Windows/DOS

Method 2: With the Script from the Command-line

          Python script can also be executed at command line by invoking the interpreter on our application.
To do this use the below commands−
$python # Unix/Linux
python% # Unix/Linux
C: >python # Windows/DOS

Method 3: Integrated Development Environment

          Python can also be run from GUI if a system has a GUI application that supports Python.
Below are shown some of the IDE for different platforms-
  •  Windows IDE – In Windows, it has PythonWin, which is the first Windows interface for Python comes with GUI.
  • Unix IDE − UNIX has IDLE IDE for Python.
  • Macintosh IDE − Macintosh has IDLE IDE which is available on the main website, which you can download as either MacBinary or BinHex'd files.  
I hope after you enjoyed reading this article and finally, you came to know about 
Getting Started with Digital Forensics in Python
For more such blogs/courses on data science, machine learning, artificial intelligence and emerging new technologies do visit us at InsideAIML.
Thanks for reading…
Happy Learning…

Submit Review