# 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:

```auto
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:

```auto
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:

```auto
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`:

```auto
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:

```auto
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:

```auto
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:

```auto
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

```auto
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:

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

Now, run the installer script:

```auto
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.)

```auto
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:

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

And run:

```auto
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)


## Related Guides

- [Analog Knobs on Raspberry Pi 400 with CYBERDECK Hat](https://learn.adafruit.com/analog-knobs-on-raspberrypi-400-with-cyberdeck-hat.md)
- [Daily Cheer Automaton](https://learn.adafruit.com/daily-cheer-automaton.md)
- [Video Playing 2.1" Round Ornament TFT](https://learn.adafruit.com/2-1-round-ornament-tft.md)
- [How to Make Games in MakeCode Arcade](https://learn.adafruit.com/how-to-make-games-on-makecode-arcade.md)
- [Adafruit PiCowbell Adalogger for Pico](https://learn.adafruit.com/adafruit-picowbell-adalogger-for-pico.md)
- [Fruit Jam Nintendo Entertainment System and Retro Jam](https://learn.adafruit.com/fruit-jam-nintendo-entertainment-system.md)
- [Talking Musical NeoPixel Clock with Infrared, BLE and Touch Controls](https://learn.adafruit.com/talking-musical-neo-pixel-clock-with-infrared-ble-and-touch-controls.md)
- [Adafruit Metro ESP32-S3](https://learn.adafruit.com/adafruit-metro-esp32-s3.md)
- [A Z80 CP/M emulator for the SAMD51](https://learn.adafruit.com/z80-cpm-emulator-for-the-samd51-grand-central.md)
- [Fruit Jam Sega Genesis](https://learn.adafruit.com/fruit-jam-sega-genesis.md)
- [Qualia S3 Fireplace](https://learn.adafruit.com/qualia-s3-fireplace.md)
- [Motion Controlled Matrix Bed Clock](https://learn.adafruit.com/motion-controlled-matrix-bed-clock.md)
- [Ultimate Youtube Live Camera](https://learn.adafruit.com/ultimate-youtube-live-camera.md)
- [Tiny Wiki for CircuitPython](https://learn.adafruit.com/tiny-wiki-for-circuitpython.md)
- [Raspberry Pi Video Synth with Blinka and Processing](https://learn.adafruit.com/raspberry-pi-video-synth-with-blinka-and-processing.md)
