# Kali Linux on the Raspberry Pi with the PiTFT

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/024/555/medium800/raspberry_pi_IMG_5644_scaled.jpg?1429596040)

Kali Linux is a&nbsp;[distribution](../../../../what-is-linux/what-about-choosing-a-distribution) especially aimed at [penetration testing](https://en.wikipedia.org/wiki/Penetration_test) and network security applications. (It's a successor to [Backtrack Linux](http://www.backtrack-linux.org/).)

Kali isn't intended as a general-purpose desktop OS for end users. Instead, it's a collection of useful tools for monitoring, exploring, and attacking networks. It comes out of the box with tools like [Wireshark](https://www.wireshark.org/), [nmap](https://nmap.org/), and [Aircrack-ng](http://www.aircrack-ng.org/), and is particularly useful in situations where you just want a disposable machine/installation with some network tools.

Enter the Raspberry Pi: Cheap, portable, low-power, and easy to customize. There's been a lot of interest in using small ARM boxes like the Pi with Kali, and it's well-supported by the maintainers.

Since the Raspberry Pi 2 was released, we've gotten a series of requests for help with getting PiTFT displays to work with Kali on the Pi 2. This guide explains how to do that, and includes a kernel package built with both our PiTFT configuration and the patches applied for a standard Kali Linux build.

Warning: 

Three guidelines for using these tools:

1. Be good to other people: Don't violate people's privacy, steal their resources, or break their networks.
2. Do the reading: Learn the purposes and effects of your tools.
3. Remember that even considered, ethical use of the tools on networks you don't own can be received badly by authorities, or violate some broadly-written laws.

If you're new to topics like pentesting, start by exploring networks you own or have sanctioned access to_._

You'll need the following:

- [A Raspberry Pi or Pi 2](https://www.adafruit.com/product/2358)&nbsp;(this guide is intended for the Pi 2, but may be of use to others)
- [An SD card appropriate for your hardware, 4 gigs or larger](https://www.adafruit.com/product/102)
- A network connection on the Pi
- [PiTFT Plus (best for use with the Pi 2 and Pi A+ or B+)](https://www.adafruit.com/product/2298)
- [PiTFT original (best used with the Pi 1 model B)](https://www.adafruit.com/product/2097)

This guide assumes [some experience with GNU/Linux systems](../../../what-is-linux/overview), and relies heavily on [the command line](../../../what-is-the-command-line).

# Kali Linux on the Raspberry Pi with the PiTFT

## Installing Kali

## Download and Copy Image to SD Card
![](https://cdn-learn.adafruit.com/assets/assets/000/024/515/medium800/raspberry_pi_Screenshot-2015-04-19-16_16_19.png?1429481799)

First, check out the&nbsp;[Kali Linux - Raspberry Pi](http://docs.kali.org/kali-on-arm/install-kali-linux-arm-raspberry-pi) page. You should find a link to&nbsp;[a downloads page](https://www.offensive-security.com/kali-linux-vmware-arm-image-download/) containing a recent image for the Raspberry Pi A/B+ or the Pi 2 - grab the one that's appropriate for your hardware. I went with `kali-1.1.0-rpi2.img.xz`.

Info: 

The rest of the Kali installation instructions are quite good - you could probably just follow them and come back here.

On my Ubuntu laptop, I decompressed the image with:

```
xz --decompress kali-1.1.0-rpi2.img.xz
```

And used the following `dd` invocation to copy the image to an SD card in my USB card reader:

```
sudo dd if=kali-1.1.0-rpi2.img of=/dev/sdc
```

## Get a Terminal on Your New Kali Box
If you're using an HDMI monitor and keyboard, you should see a login prompt after the Pi finishes booting, looking something like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/024/512/medium800/raspberry_pi_IMG_5639.jpg?1429479755)

By default, the user is **root** and the password is **toor**.

Alternatively, you can make sure the Pi is connected to the network, and use an SSH client from another machine. That's the approach I'm taking:

![](https://cdn-learn.adafruit.com/assets/assets/000/024/509/medium800thumb/raspberry_pi_screencast-2015-04-19-15_29_59.jpg?1448317619)

I know that my Pi is at 192.168.1.4 because I configured my router to always assign that IP address to its ethernet interface's MAC. If you don't know yours for sure, you can take a couple of approaches. The simplest is probably to log in from a console and type `ifconfig`:

![](https://cdn-learn.adafruit.com/assets/assets/000/024/513/medium800/raspberry_pi_IMG_5641.jpg?1429480443)

Just look for the `eth0` line containing a string like `inet addr:192.168.1.4`.

If that's not an option and you have access to a machine with [Nmap](https://nmap.org/) installed, you can instead try doing a ping sweep of your network with a command like `nmap -sn 192.168.1.1-254 `:

![](https://cdn-learn.adafruit.com/assets/assets/000/024/514/medium800/raspberry_pi_Screenshot-2015-04-19-16_06_46.png?1429481229)

You could also use [the Adafruit Pi Finder](../../../../the-adafruit-raspberry-pi-finder/overview) from a Windows, Mac, or Linux desktop to locate the Pi and get a terminal.

## Basic Post-Installation Setup
Once logged in, you should do a bit of simple housekeeping on the new installation.

Since it's not very safe to leave the default password on a machine, start by setting a new password for the root user with the `passwd` command:

![](https://cdn-learn.adafruit.com/assets/assets/000/024/511/medium800thumb/raspberry_pi_screencast-2015-04-19-15_35_14.jpg?1448317624)

Once that's done, reconfigure the OpenSSH server to generate new host keys with `dpkg-reconfigure openssh-server`:

![](https://cdn-learn.adafruit.com/assets/assets/000/024/510/medium800/raspberry_pi_Screenshot-2015-04-19-15_33_39.png?1429479239)

That should be it! Now we can move on to setting up the PiTFT.

# Kali Linux on the Raspberry Pi with the PiTFT

## Configuring the PiTFT

![](https://cdn-learn.adafruit.com/assets/assets/000/024/516/medium800/raspberry_pi_x1601-00.jpg.pagespeed.ic.ptI8PZq86n.jpg?1429483875)

For this guide, I'm using the [PiTFT - Assembled 320x240 2.8" TFT+Touchscreen](https://www.adafruit.com/product/1601), but these instructions should work for any hardware supported by the [Adafruit PiTFT Helper](https://github.com/adafruit/Adafruit-PiTFT-Helper), including the 2.8" capacitive version, the 2.2" version, and the [3.5" version](https://www.adafruit.com/product/2097).

# If You Don't Care About Using Kali's Kernel Patches
Detailed instructions for configuring a PiTFT on a Raspbian system can be found here:

[Adafruit PiTFT - 2.8" Touchscreen Display for Raspberry Pi](https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/overview)
...and in fact, these would mostly work for Kali. If you just want a working Kali install with the stock Adafruit kernel, you can mount the boot partition, and then follow the [instructions for installing adafruit-pitft-helper plus our kernel](../../../../adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/easy-install#diy-installer-script). Here's the quick and dirty version.

First, while logged in as root, make sure the boot partition (the first partition on the SD card) is available for writing:

```
mount /dev/mmcblk0p1 /boot
```

This will let us install a custom kernel and rewrite files like `config.txt` and `cmdline.txt` to configure the display. Next, add **apt.adafruit.com** to your package repository lists, and install `adafruit-pitft-helper`:

```
curl -SLs https://apt.adafruit.com/add | bash
apt-get install -y adafruit-pitft-helper
```

Then wait until everything has installed (this will take quite a while), and run the helper script:

```
adafruit-pitft-helper -u /root/ -t 28r
```

Make sure you change `-t 28r` to an appropriate value for your hardware, if it differs from the 2.8" resistive screen. `adafruit-pitft-helper -h` will list the valid values.

# If You Want the Kali Kernel Patches
This process is a bit more manual, at the moment, but should work.

First, as above, mount the boot partition:

```
mount /dev/mmcblk0p1 /boot
```

Next, you'll need some kernel packages.

If you're a glutton for punishment, you can build these using our [Raspberry Pi Kernel-o-Matic](https://github.com/adafruit/Adafruit-Pi-Kernel-o-Matic), which uses Vagrant to spin up a little virtual machine just for cross-compiling Pi kernels. We have a[guide](../../../../raspberry-pi-kernel-o-matic/overview) for the basics of installation; in particular, here we need to [do a custom build](../../../../raspberry-pi-kernel-o-matic/build-a-kernel#custom-pitft-builds) using&nbsp;[this branch of the Adafruit kernel repository](https://github.com/adafruit/adafruit-raspberrypi-linux/tree/rpi-kali-3.18.y) which contains Kali's patches along with our tweaks for the PiTFT. Once you have the Vagrant box running, do `vagrant ssh` to connect, and then build the kernel like so:

```
sudo adabuild -b rpi-kali-3.18.y
```

If you'd rather skip this process, you can download a pre-built set of packages here:

[Download the prebuilt Kernel package](http://adafruit-download.s3.amazonaws.com/adafruit_pitft_kernel_1.20150420-1.tar.gz)
or by running

```
wget http://adafruit-download.s3.amazonaws.com/adafruit_pitft_kernel_1.20150420-1.tar.gz
```

Either way, once you have a file like `adafruit_pitft_kernel_1.20150420-1.tar.gz`, copy it to `/root` on your Pi, and extract it like so:

```
tar xf adafruit_pitft_kernel_1.20150420-1.tar.gz
```

Now, run the installer script:

```
cd adafruit_pitft_kernel_1.20150420-1
./install.sh
```

 **This will take a long time.** Once finished, it'll prompt to reboot the Pi immediately. It's safe to say **y** es, or **n** o if you want to check the contents of `/boot` to make sure that the kernel and related files got replaced properly, which you can do with `ls -l /boot`:

![](https://cdn-learn.adafruit.com/assets/assets/000/024/549/medium800/raspberry_pi_Screenshot-2015-04-20-22_03_04.png?1429589001)

Once you've done that, restart the machine with `reboot`.

![](https://cdn-learn.adafruit.com/assets/assets/000/024/550/medium800thumb/raspberry_pi_screencast-2015-04-20-22_05_09.jpg?1448317634)

Finally, download and run the PiTFT helper script. (Grab it directly from GitHub rather than installing from apt.adafruit.com, because the packaged version depends on a different kernel package.)

```
git clone https://github.com/adafruit/Adafruit-PiTFT-Helper.git
```

![](https://cdn-learn.adafruit.com/assets/assets/000/024/545/medium800/raspberry_pi_Screenshot-2015-04-20-14_27_33.png?1429561696)

Mount the boot partition again:

```
mount /dev/mmcblk0p1 /boot
```

And run:

```
cd Adafruit-PiTFT-Helper
./adafruit-pitft-helper -u /root/ -t 28r
```

You'll be prompted to answer a few questions.

![](https://cdn-learn.adafruit.com/assets/assets/000/024/551/medium800thumb/raspberry_pi_screencast-2015-04-20-22_19_26.jpg?1448317639)

Your output will likely look a bit different from this (I recorded the above GIF after I'd already configured the screen once), but should be similar.

Now `reboot` again, and you should be good to go!

![](https://cdn-learn.adafruit.com/assets/assets/000/024/552/medium800/raspberry_pi_20150420_222244.jpg?1429590241)

You should also be able to run `startx` at the prompt and land on the desktop.

![](https://cdn-learn.adafruit.com/assets/assets/000/024/553/medium800/raspberry_pi_20150420_222937.jpg?1429590657)


## Featured Products

### Raspberry Pi 2 - Model B v1.2 - ARM Cortex-A53 with 1G RAM

[Raspberry Pi 2 - Model B v1.2 - ARM Cortex-A53 with 1G RAM](https://www.adafruit.com/product/2358)
Didn't think the Raspberry Pi could get any better? You're in for a big surprise! The Raspberry Pi 2 Model B is out and it's amazing! With an upgraded ARM Cortex-A53&nbsp;quad-core processor, Dual Core VideoCore IV Multimedia coprocessor, and a full Gigabyte of RAM, this...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2358)
[Related Guides to the Product](https://learn.adafruit.com/products/2358/guides)
### USB WiFi (802.11b/g/n) Module with Antenna for Raspberry Pi

[USB WiFi (802.11b/g/n) Module with Antenna for Raspberry Pi](https://www.adafruit.com/product/1030)
Discontinued - [**you can grab** USB WiFi (802.11b/g/n) Module: For Raspberry Pi and more **instead!&nbsp;**](https://www.adafruit.com/product/1012)

Make your Internet of Things device cable-free by adding super WiFi. Take advantage of the Raspberry Pi and Beagle...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1030)
[Related Guides to the Product](https://learn.adafruit.com/products/1030/guides)
### USB WiFi (802.11b/g/n) Module: For Raspberry Pi and more

[USB WiFi (802.11b/g/n) Module: For Raspberry Pi and more](https://www.adafruit.com/product/1012)
Make your Internet of Things device cable-free by adding WiFi. Take advantage of the Raspberry Pi and Beagle Bone's USB port to add a low cost, but high-reliability wireless link. We tried half a dozen modules to find one that works well with the Pi and Bone without the need of recompiling...

In Stock
[Buy Now](https://www.adafruit.com/product/1012)
[Related Guides to the Product](https://learn.adafruit.com/products/1012/guides)
### Adafruit PiTFT - 320x240 2.8" TFT+Touchscreen for Raspberry Pi

[Adafruit PiTFT - 320x240 2.8" TFT+Touchscreen for Raspberry Pi](https://www.adafruit.com/product/1601)
Is this not the cutest little display for the Raspberry Pi? It features a 2.8" display with 320x240 16-bit color pixels and a resistive touch overlay. The plate uses the high speed SPI interface on the Pi and can use the mini display as a console, X window port, displaying images or video...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1601)
[Related Guides to the Product](https://learn.adafruit.com/products/1601/guides)
### PiTFT 2.8" TFT 320x240 + Capacitive Touchscreen for Raspberry Pi

[PiTFT 2.8" TFT 320x240 + Capacitive Touchscreen for Raspberry Pi](https://www.adafruit.com/product/1983)
 **Discontinued**  **-**  **but check out the** &nbsp;[**Adafruit PiTFT Plus 320x240 2.8" TFT + Capacitive Touchscreen**](https://www.adafruit.com/product/2423)

Our best-selling PiTFT 2.8" display just got a fancy...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1983)
[Related Guides to the Product](https://learn.adafruit.com/products/1983/guides)
### PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen

[PiTFT Plus Assembled 320x240 2.8" TFT + Resistive Touchscreen](https://www.adafruit.com/product/2298)
Is this not the cutest little display for the Raspberry Pi? It features a 2.8" display with 320x240 16-bit color pixels and a resistive&nbsp;touch overlay. The plate uses the high speed SPI interface on the Pi and can use the mini display as a console, X window port, displaying images or...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2298)
[Related Guides to the Product](https://learn.adafruit.com/products/2298/guides)
### Adafruit PiTFT Plus 320x240 2.8" TFT + Capacitive Touchscreen

[Adafruit PiTFT Plus 320x240 2.8" TFT + Capacitive Touchscreen](https://www.adafruit.com/product/2423)
Is this not the cutest little display for the Raspberry Pi? It features a 2.8" display with 320x240 16-bit color pixels and a capacitive touch overlay.&nbsp;That's right, instead of a resistive touchscreen, which requires a fingernail or stylus, you can now use a fingerpad. The screen...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2423)
[Related Guides to the Product](https://learn.adafruit.com/products/2423/guides)
### PiTFT - Assembled 480x320 3.5" TFT+Touchscreen for Raspberry Pi

[PiTFT - Assembled 480x320 3.5" TFT+Touchscreen for Raspberry Pi](https://www.adafruit.com/product/2097)
Is this not the cutest, little display for the Raspberry Pi? It features a **3.5" display with 480x320** 16-bit color pixels and a resistive touch overlay so is slightly larger than [our popular original](https://www.adafruit.com/product/1601). The plate uses the...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2097)
[Related Guides to the Product](https://learn.adafruit.com/products/2097/guides)

## Related Guides

- [Raspberry Pi Pipboy 3000](https://learn.adafruit.com/raspberry-pi-pipboy-3000.md)
- [RasPi - Animated GIF Picture Frame](https://learn.adafruit.com/raspi-animated-gif-picture-frame.md)
- [Using OSC to Communicate with a Raspberry Pi](https://learn.adafruit.com/raspberry-pi-open-sound-control.md)
- [Monitor PiCam and temperature on a PiTFT via adafruit.io](https://learn.adafruit.com/monitor-picam-and-temperature-on-a-pitft-via-adafruit-dot-io.md)
- [CYBERDECK Expansion Plate](https://learn.adafruit.com/cyberdeck-plate.md)
- [PiGRRL - Raspberry Pi Gameboy](https://learn.adafruit.com/pigrrl-raspberry-pi-gameboy.md)
- [Adafruit PiTFT 3.5" Touch Screen for Raspberry Pi](https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi.md)
- [Raspberry Pi + Teachable Machine = Teachable Pi](https://learn.adafruit.com/teachable-machine-raspberry-pi-tensorflow-camera.md)
- [RasPipe: A Raspberry Pi Pipeline Viewer, Part 2](https://learn.adafruit.com/raspipe-a-raspberry-pi-pipeline-viewer-part-2.md)
- [PiPhone - A Raspberry Pi based Cellphone](https://learn.adafruit.com/piphone-a-raspberry-pi-based-cellphone.md)
- [Adafruit PiTFT - 2.8" Touchscreen Display for Raspberry Pi](https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi.md)
- [PiTFT Python + Pillow Animated Gif Player](https://learn.adafruit.com/pitft-linux-python-animated-gif-player.md)
- [Pi Hole Ad Detection Display with PiTFT](https://learn.adafruit.com/pi-hole-ad-pitft-tft-detection-display.md)
- [Hang out your washing reminder - Adafruit IO + Vibration switch](https://learn.adafruit.com/hang-out-your-washing-reminder-adafruit-io-vibration-switch.md)
- [Adafruit's Raspberry Pi Lesson 2. First Time Configuration](https://learn.adafruit.com/adafruits-raspberry-pi-lesson-2-first-time-configuration.md)
