Kali Linux, or simply Kali, is the newest Linux distribution from Offensive Security. It is the successor to the BackTrack Linux distribution. Unlike most Linux distributions, Kali Linux is used for the purposes of penetration testing. Penetration testing is a way of evaluating the security of a computer system or network by simulating an attack. Throughout this book, we will further explore some of the many tools that Kali Linux has made available.
This chapter covers the installation and setup of Kali Linux in different scenarios, from inserting the Kali Linux DVD to configuring the network.
For all the recipes in this and the following chapters, we will use Kali Linux using GNOME 64-bit as the Window Manager (WM) flavor and architecture (http://www.Kali.org/downloads/). The use of KDE as the WM is not covered in this book; however, you should be able to follow the recipes without much trouble.
Performing the steps covered in this recipe will erase your hard drive, making Kali Linux the primary operating system on your computer.
Before explaining the procedure, the following requirements need to be met:
A minimum of 8 GB of free disk space for the Kali Linux install (although, we recommend at least 25 GB to hold additional programs and wordlists generated with this book)
A minimum of 512MB of RAM
You can download Kali Linux at http://www.kali.org/downloads/
Let's begin with the installation.
Begin by inserting the Kali Linux Live DVD in the optical drive of your computer. You will ultimately come to the Kali Linux Live DVD Boot menu. Choose Graphical install.
You will now be presented with the opportunity to choose the password for the root user by entering a password twice.
Next, you have the option of choosing one of three partitioning schemes: All files in one partition, Separate/home partition, or Separate/home/user/var, and/tmp partitions. Considering Kali is being used more so for penetration testing purposes, a separation of partitions is not needed nor required (even though this is a great idea for your main desktop Linux distribution). In this case, choose All files in one partition and click on Continue.
Once you get to the screen which lets you know that changes are about to be made to your disks, choose Yes and click on Continue. Please note that this is the final chance to back out of having all of your data on your disc overwritten.
Next, you will be asked if you want to connect to a network mirror. A network mirror allows you to receive updates for Kali as they become available. In this case, we choose Yes and click on Continue.
Having a Kali Linux USB drive provides us with the ability to persistently save system settings and permanently update and install new software packages onto the USB device, allowing us to carry our own personalized Kali Linux, with us at all times.
Thanks to tools such as Win32 Disk Imager, we can create a bootable Live USB drive of a vast majority of Linux distributions, including Kali Linux with persistent storage.
The following tools and preparations are needed in order to continue:
A FAT32-formatted USB drive with a minimum capacity of 8 GB
A Kali Linux ISO image
Win32 Disk Imager (http://sourceforge.net/projects/win32diskimager/files/latest/download)
You can download Kali Linux from http://www.kali.org/downloads/
Start Win32 Disk Imager.
At the Image File location, click on the folder icon and select the location of the Kali Linux DVD ISO image:
Make sure that Space used to preserve files across reboots is set to 4096.
The process will take some time to complete while it extracts and copies the DVD files to the USB and installs the bootloader.
When the installation is complete, we're ready to reboot the computer and boot from the newly created Kali Linux USB drive with persistent memory:
This recipe will take you through the installation of Kali Linux in a completely isolated guest operating system within your host operating system using the well-known open source virtualization software: VirtualBox.
The required prerequisites are listed as follows:
Let's begin the process of installing Kali Linux in Virtualbox:
Launch VirtualBox and click on New to start the Virtual Machine Wizard:
Click on the Next button, type the name of the virtual machine, and choose the OS type as well as the version. In this case, we selected an operating system of Linux and Ubuntu (64 bit) as the version. Click on the Next button to continue:
We'll leave the default option as the virtual disk storage details. Click on Next to continue.
Set the virtual disk file location and size:
We're back to the previous wizard with the summary of the virtual machine parameters. Click on Create to finish:
Now that the basic installation steps have been followed, we will proceed to allow you to use your downloaded ISO file as a virtual disc. This will save you from having to burn a physical DVD to complete the installation. On the Settings screen, click on the Storage menu option:
Next, under Storage Tree, highlight the Empty disc icon underneath IDE Controller. This selects our virtual CD/DVD ROM drive. To the far right of the screen, under Attributes, click on the disc icon. In the pop up that follows, select your Kali Linux ISO file from the list. If the Kali Linux ISO file is not present, select the Choose a virtual CD/DVD disc file... option and locate your ISO. Once you have completed these steps, click on the OK button:
The following requirements need to be fulfilled:
A previously installed Kali Linux VMware virtual machine
An Internet connection
Let's begin the process of installing Kali Linux on VMware:
With your virtual machine's guest operating system powered on and connected to the Internet, open a Terminal window and type the following command to prepare the kernel sources:
Copy the VMware Tools installer to a temporary location and then change the location to the target directory:
cp /media/VMware\ Tools/VMwareTools-8.8.2-590212.tar.gz /tmp/; cd /tmp/
Untar the installer by issuing the following command:
tar zxpf VMwareTools-8.8.2-590212.tar.gz
Go to the VMware Tools' directory and run the installer:
cd vmware-tools-distrib/ ./vmware-install.pl
Press Enter to accept the default values in each configuration question; the same applies with the
Finally, reboot and we're done!
In the first step, we prepared our kernel source. Next, we virtually inserted the VMware Tools CD into the guest operating system. Then, we created the mount point and mounted the virtual CD drive. We copied and extracted the installer in a temporary folder and finally we ran the installer leaving the default values.
The first time we boot into our newly installed Kali Linux system, we will notice that the splash screen has disappeared. In order to manually fix it, we need to extract
Initrd, modify it, and then compress it again. Thankfully, there's an automated bash script created by Mati Aharoni (also known as "muts", creator of Kali Linux) that makes the whole process easier.
Kali Linux comes with several network services which may be useful in various situations and are disabled by default. In this recipe, we will cover the steps to set up and start each service using various methods.
The following requirement is needed in order to continue:
A connection to the network with a valid IP address
Let's begin the process of starting our default service:
Start the Apache server:
service apache2 start
We can verify the server is running by browsing to the localhost address.
service ssh start
To verify the server is up and listening, use the
netstat -tpan | grep 22
Start the FTP server:
service pure-ftpd start
To verify the FTP server, use the following command:
netstat -ant | grep 21
To stop a service, just issue the following command:
service <servicename> stop
<servicename>stands for the network service we want to stop. For example:
service apache2 stop
To enable a service at boot time, use the following command:
update-rc.d –f <servicename> defaults
<servicename>stands for the network service we want at boot time. For example:
update-rc.d –f ssh defaults
At last we come to the final recipe of this chapter. In this recipe, we will see the steps needed to connect to our wireless network with security enabled by using Wicd Network Manager and supplying our encryption details. Setting up our wireless network enables us to use Kali Linux wirelessly. In a true, ethical penetration test, not having to depend on an Ethernet cable enables us to have all of the freedoms of a regular desktop.
Let's begin setting up the wireless network:
From the desktop, start the network manager by clicking on the Applications menu and navigating to Internet | Wicd Network Manager or by issuing the following command at the Terminal window:
Wicd Network Manager will open with a list of available networks: