-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Penetration Testing with Raspberry PI
We know that it's tempting to just dive on into the Kali Linux interface and start running some great security tools. But first, there are some important housekeeping items to take care of. These items are as follows:
First on our list is to change our password. Kali Linux ships with the same default credentials, so we'll want to make sure that no one can log into our box except us. How embarrassing would be it if we had our penetration testing box penetrated by another party. Think of the irony there! To start this process, we need to open up a terminal and enter the passwd command. We'll be asked to type the password in twice to make sure that it is correct:

The other very important thing to do is to update Kali as soon as we can. This will ensure that we have the latest and greatest versions of code and applications. The process for updating Kali is pretty straightforward. We'll simply type the following commands into the CLI.
The upgrade will install all the newest version of the packages installed. The dist-upgrade command will install this plus intelligently updates all the dependencies with the new versions of packages. The dist-upgrade command is certainly not required, but we definitely recommend it:
apt-get update apt-get upgrade apt-get dist-upgrade
After this, we reboot our Raspberry Pi 3, and when it comes back, we should have a fully updated operating system, ready for playing around with some pen-testing tools.
Next, we want to resize the partition to use all the available space on our 32GB microSD card. We will show two different ways of doing this. The first way will be via the CLI. The second will take advantage of gparted in GUI.
Starting with CLI, if we run the df -h command, the following figure shows we don't have a partition that is close to the size of our microSD card. It is currently only at 6.7G:

The process to expand this partition involves a couple of steps. The following steps will help us unlock the full usable size of our microSD card. It is important to have that extra space for log files, command outputs, or tcpdumps.
We need to make sure that we follow the steps very carefully, as we wouldn't want to erase our root partition. This process uses the fdisk, parted and resize2fs commands. Here is the process that we used:
fdisk command to check our current partitions:fdisk /dev/mmcblk0
This will get us into the fdisk utility so that we can plan our changes to the partition table.
p. This will dump out the partition information for our microSD card:

fdisk utility by typing q. We now want to get into the parted utility and specify the microSD card we wish to modify. The device information was gleaned from the previous step. We can accomplish this by typing the following command:parted /dev/mmcblk0
(parted) prompt, we will want to change the unit to chs, which is for cylinders, head, and sectors. This will allow us to get the correct numbers for the resize. To do this, let's type chs:(parted) unit chs
print at the prompt:(parted) print
Disk. In our example, it was the following:Disk /dev/mmcblk0: 3822,237,62
chs unit, we can delete the second partition. Let's pay particular attention here, as we don't want to delete the root partition. At the prompt, we will want to type rm 2, where 2 is the partition number: (parted) rm 2
Ignore or Cancel. Let's type i to ignore:Ignore/Cancel? i
(parted) print

parted again, but this time to create the partition. First, let's start the tool by entering the parted command. Once in parted, we can make the new larger partition. This is where those numbers we saw and recorded in the parted print command in the previous section come into play. At the prompt, we will want to use mkpart to make the partition, with the first number being one number higher than the End sector number on the first partition. The second number is the disk number size we saw in that same output. For our microSD card partition, we ran the following command:(parted) mkpart primary 7,199,9 3822,237,62
i to ignore it. After that, we want to verify that our partition has been created. We can use the print command under parted to accomplish this. We should see the second entry, which shows the correct usable space for our microSD card. We can now quit out of parted. The following screenshot shows steps 11 and 12 of our example:

resize2fs command. We will run this against that newly formed partition. The following command results in the following screenshot:resize2fs /dev/mmcblk0p2

df -h command we did initially. We should see that the size closely matches our microSD card's advertised usable space:

Now that we've seen the CLI commands to increase that partition size, let's look at another way of using the GUI interface within Kali Linux. These steps will walk through the process:
gparted, which is installed using the following command:apt-get install gparted

gparted. Once the GUI has started, we can click on the Resize/Move button:





gparted to accomplish this.Change the font size
Change margin width
Change background colour