Kali Linux on Raspberry Pi

Just some notes on my Kali build with Raspberry Pi…

0. Materials

Soldering is required to attach the header that connects the hat to the pi.

1. Prepare OS

Download the image and use Etcher to flash the SD card with Kali Linux. You don’t even have to decompress the image.

2. Basic Setup

Insert the SD card into the Raspberry Pi and plug in the micro USB power source.

You’ll need to hook up an external monitor for the first boot in order to prepare the machine for console use.

Login as root:toor, set up the wifi, and run the standard stuff:

apt-get update
apt-get full-upgrade

Make sure to change the default password:

passwd root

Change the default SSH keys:

dpkg-reconfigure openssh-server

Edit the file /etc/ssh/sshd_config and change the line with PermitRootLogin to:

PermitRootLogin yes

Finally, enable autologin so that ssh can work on boot12. Edit /etc/lightdm/lightdm.conf and uncomment the lines:

autologin-user=root
autologin-user-timeout=0

Next edit /etc/pam.d/lightdm-autologin and comment out:

# auth required pam_succeed_if.so user != root quiet_success

After this step, you can reboot whenever and have ssh access with your root user.

Optionally, you can change the hostname so that people don’t know this is a kali box, or to make it easier to find yours.

vim /etc/hostname

3. Prepare for a console-only experience

Set Kali to boot into console mode:

systemctl set-default multi-user.target
systemctl get-default # this command checks the setting
reboot

Clone the following repos:

The first repo has adafruit-pitft.sh which is used to automatically configure the TFT display but since we’re on Kali some of the dependencies for the script are unvailable which is why we need the second repo.

In the py-spidev folder, run:

make
make install

Go into the Raspberry-Pi-Installer-Scripts folder and edit the adafruit-pitft.sh file. In this file, remove the part where it tries to install python-spidev and tslib. Then, run:

./adafruit-pitft.sh -u /root

This will ask you what screen you have and what configuration/rotation you prefer. Afterwards, when you reboot you should see the console show up on the display. I prefer the 270 degrees (landscape) setting as this will place the buttons below the display.

I’m still unable to figure out the buttons on a Kali image. If anyone out there has any input, please let me know :)

To edit wifi, there are two ways:

wpa_supplicant -B -i wlan0 -c <(wpa_passphrase "MYSSID" 12345678) && dhclient wlan0
# or 
nmcli d wifi connect MYSSID password 12345678 iface wlan0

4. Get Sound

Get sound to work In /boot/config.txt uncomment and edit the line:

dtparam=audio=on

Install and enable dependencies:

apt-get install alsa-utils
systemctl --user enable pulseaudio && systemctl --user start pulseaudio
reboot
systemctl --user status pulseaudio

Test the tone:

play -n -c1 synth 10 sine 1000


Sources: