Kali Linux on the Raspberry Pi with the PiTFT

Kali Linux on the Raspberry Pi with the PiTFT
Kali Linux on the Raspberry Pi with the PiTFT
Created by Brennen Bearnes
Last updated on 2015-09-14 05:12:03 PM EDT
Guide Contents
Guide Contents
Overview
Installing Kali
Download and Copy Image to SD Card
Get a Terminal on Your New Kali Box
Basic Post-Installation Setup
Configuring the PiTFT
If You Don't Care About Using Kali's Kernel Patches
If You Want the Kali Kernel Patches
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
2
3
5
5
6
8
10
10
11
Page 2 of 15
Overview
Kali Linux is a distribution (http://adafru.it/evA) especially aimed at penetration
testing (http://adafru.it/eZN) and network security applications. (It's a successor to Backtrack
Linux (http://adafru.it/eZO).)
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 (http://adafru.it/eDB), nmap (http://adafru.it/eZP), and Aircrack-ng (http://adafru.it/eZQ),
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.
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 3 of 15
It goes without saying that Kali is built on a set of tools that can be used maliciously. Less
obviously, they can get you in a lot of hot water.
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 (http://adafru.it/eCB) (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 (http://adafru.it/eZR)
A network connection on the Pi
PiTFT Plus (best for use with the Pi 2 and Pi A+ or B+) (http://adafru.it/eZS)
PiTFT original (best used with the Pi 1 model B) (http://adafru.it/e27)
This guide assumes some experience with GNU/Linux systems (http://adafru.it/eZU), and relies
heavily on the command line (http://adafru.it/eZV).
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 4 of 15
Installing Kali
Download and Copy Image to SD Card
First, check out the Kali Linux - Raspberry Pi (http://adafru.it/eZW) page. You should find a link to a
downloads page (http://adafru.it/eZX) 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 .
As of this writing, the v1.0.9 image for the Raspberry Pi A/B+ TFT may work out of the box on
a Model B+ with a PiTFT, and might even supply all the drivers and configuration you need for
the PiTFT display. It will not boot on a Pi 2, which is why we're going to do it the 'long' way
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
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 5 of 15
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:
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:
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 6 of 15
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 :
Just look for the eth0 line containing a string like inet addr:192.168.1.4 .
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 7 of 15
If that's not an option and you have access to a machine with Nmap (http://adafru.it/eZP) installed,
you can instead try doing a ping sweep of your network with a command like nmap -sn 192.168.1.1254 :
You could also use the Adafruit Pi Finder (http://adafru.it/eZY) 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:
Once that's done, reconfigure the OpenSSH server to generate new host keys with dpkg-reconfigure
openssh-server :
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 8 of 15
That should be it! Now we can move on to setting up the PiTFT.
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 9 of 15
Configuring the PiTFT
For this guide, I'm using the PiTFT - Assembled 320x240 2.8"
TFT+Touchscreen (http://adafru.it/dDE), but these instructions should work for any hardware
supported by the Adafruit PiTFT Helper (http://adafru.it/eIn), including the 2.8" capacitive version,
the 2.2" version, and the 3.5" version (http://adafru.it/e27).
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
http://adafru.it/eZZ
...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 Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 10 of 15
adafruit-pitft-helper plus our kernel (http://adafru.it/dTa). 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-pitfthelper :
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-oMatic (http://adafru.it/epp), which uses Vagrant to spin up a little virtual machine just for crosscompiling Pi kernels. We have a guide (http://adafru.it/f00) for the basics of installation; in particular,
here we need to do a custom build (http://adafru.it/f01) using this branch of the Adafruit kernel
repository (http://adafru.it/f02) 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:
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 11 of 15
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://adafru.it/f03
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
yes, or no 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 :
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 12 of 15
Once you've done that, restart the machine with reboot .
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.)
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 13 of 15
git clone https://github.com/adafruit/Adafruit-PiTFT-Helper.git
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.
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.
© Adafruit Industries https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft
Page 14 of 15
Now reboot again, and you should be good to go!
You should also be able to run startx at the prompt and land on the desktop.
© Adafruit Industries
Last Updated: 2015-09-14 05:12:04 PM EDT
Page 15 of 15
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement