Kali Linux 2 Sana – Raspberry Pi 2 Wireless Tools Custom Build

Ok, it’s been a while since I last built a Custom Kali image for the raspberry Pi 2. It’s become much easier to build an image now and it takes very few steps which is excellent!

First start by creating a new directory called arm-stuff
mkdir ~/arm-stuff
Change into the arm-stuff directory
cd ~/arm-stuff
Clone the cross compiler for the armhf image from github
git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7
Set export PATH to set your cross compiler directory
export PATH=${PATH}:/root/arm-stuff/gcc-arm-linux-gnueabihf-4.7/bin
Clone the kali-arm-build-scripts from git
git clone https://github.com/offensive-security/kali-arm-build-scripts
Change into the newly created kali-arm-build-scripts directory
cd ~/arm-stuff/kali-arm-build-scripts

1_Kali_2_Rasberry_Pi_2_prep_work

1_Kali_2_Rasberry_Pi_2_prep_work

Running “ls” will show you everything in the kali-arm-build-scripts directory, use your editor of choice and open the Raspberry Pi 2 script “rpi2.sh” and modify it if you want to follow along and install only the wireless tools or you can leave the next two steps and just run “build-deps.sh” to install any dependacies you may require to build your image.

2_Kali_2_Rasberry_Pi_2_read_rpi2

2_Kali_2_Rasberry_Pi_2_read_rpi2

Modify everything after the “tools=” variable and replace the current string with “kali-linux-wireless” to install only the wireless tools. You can get a full list of meta packages to configure different builds.

3_Kali_2_Rasberry_Pi_2_rpi2_modify

3_Kali_2_Rasberry_Pi_2_rpi2_modify

I also like to keep the image file created during the build creation process so that I don’t have to run unxz against the newly created img.xz file when finished, once again completely optional and a personal preference.

4_Kali_2_Rasberry_Pi_2_rpi2_modify2

4_Kali_2_Rasberry_Pi_2_rpi2_modify2

Next before starting off the build process you should also check for any dependencies you may require by running build-deps.sh which should finish without any error.

5_Kali_2_Rasberry_Pi_2_rpi2_build-deps

5_Kali_2_Rasberry_Pi_2_rpi2_build-deps

Run the rpi2.sh script followed by whatever you want to name your finished build. My name below is “Kali_Pi2_Custom_Wireless_Tools” but feel free to change the name to anything else.

6_Kali_2_Rasberry_Pi_2_rpi2_start_build

6_Kali_2_Rasberry_Pi_2_rpi2_start_build

Let this run for some time depending on your system and Internet speed and when finished you should see a similar result like I have below:

7_Kali_2_Rasberry_Pi_2_rpi2_finish_build

7_Kali_2_Rasberry_Pi_2_rpi2_finish_build

Checking the contents of the directory with “ls” you will now see a newly created directory with your custom image inside.

8_Kali_2_Rasberry_Pi_2_rpi2_custom_image_location

8_Kali_2_Rasberry_Pi_2_rpi2_custom_image_location

Use dd to transfer the image to your microsd card:

dd if=name_of_image.img of=/your/microsd bs=1M

As always be very careful with dd so as not to image your running disk as it will destroy any drive or partition if you copy it to the wrong location, use “fdisk -l” and plug your card in and out and see what changes to get the correct device to copy to. You may see something like “/dev/sdb1” and “/dev/sdb2” in this case you want to use the whole disk so choose “/dev/sdb” to get the root of the drive.

When finished the transfer run “sync” to synchronize any cached writes to persistent storage, the persistent storage being your microsd card because if you remove it to early the copy may not have fully completed yet even though the dd process has finished. Just run it and see how long it takes, if it finishes quickly that just means it’s fully finished. Otherwise it may take a minute or two, when that happens be glad you ran it or you would have had to run the dd transfer again as the image would be corrupted!

9_Kali_2_Rasberry_Pi_2_rpi2_custom_image_dd_to_microsd_card

9_Kali_2_Rasberry_Pi_2_rpi2_custom_image_dd_to_microsd_card

Next remove your microsd and plug it into your Raspberry Pi 2 and boot it up!

Kali_Pi_2_Hacker_Cat

Kali_Pi_2_Hacker_Cat

It might be wise to remove any pets from the process…