Penetration Testing Distributions for Raspberry Pi
PwnPi is a penetration testing distribution for the Raspberry Pi, this guide will explain how to install it for your Raspberry Pi. The best way to describe it can be found on the PwnPi website:
“PwnPi is a Linux-based penetration testing dropbox distribution for the Raspberry Pi. It currently has 200+ network security tools pre-installed to aid the penetration tester. It is built a stripped down version of the Debian Wheezy image from the Raspberry Pi foundation’s website and uses Openbox as the window manager. PwnPi can be easily setup to send reverse connections from inside a target network by editing a simple configuration file.”
You will need a 4 GB SD card to flash the image to. You can use a program like Ubuntu startup disk creator or you can use dd or dcfldd on Linux, or use Win32 Disk Imager or RUFUS on Windows.
Here is dd method for this example but if need to use dcfldd just swap out dd for dcfldd in the following command:
sudo dd bs=1M if=<PATH TO FILE> of=</dev/sdX> && sync
Replace <PATH TO FILE> and </dev/sdX> with the relevant information, if you don’t know where your SD card is mounted run lsblk to find out, for example the command can be looked like this :
sudo dd bs=1M if=/root/Downloads/pwnpi-3.0.img of=/dev/sdb && sync
When the command is finished safely remove your SD card and insert it into your Raspberry Pi, plug in the power and let it boot up. PwnPi should be ready to use, enjoy pen-testing!
Of course to install Kali all steps are same just to download Raspberry version of Kali should use Kali project official website and choose suitable version for your Raspberry Pi model under RaspberryPi Foundation part of this page.
And it’s better to use bs=512 for Kali and use command like below:
sudo dd bs=512 if=/root/Downloads/kali-2.1.2-rpi2.img.xz of=/dev/sdb && sync
A note about the Raspberry Pi: if you have a keyboard and mouse plugged in (which you should) the Pi often takes more power than a standard AC adapter can provide. It’s better to use a powered USB hub to make sure that all of peripherals work. However, the default PwnPi image is pretty out of date and may not support your USB mouse/keyboard. Even if it does, it’s a good idea to update Raspberry Pi to the latest versions of software. Before do this however, need to expand the file system to encompass the entire SD card.
In PwnPi image file that wrote to the SD card constituted a bit-by-bit image of the file system; unfortunately this included a minimally sized data partition. If need to expand this partition. To do this, start the Raspberry Pi Software Configuration Tool by entering the following at console:
The first choice should be “Expand file system”, which is the subject of this task. Press Enter and follow the prompts. Reboot when asked to. When the Pi has rebooted, it is possible to begin the process of updating its software. Enter Aptitude, the package management system on the Pi by entering the following:
Once in Aptitude, press the “u” key to get the list of latest updates available. The Pi will update the latest list of packages from the Raspbian sources. When it’s finally finished updating there should be a large amount of packages available for update. Select “Upgradable Packages” and press the ‘+’ key. This will select all upgradable packages for installation. Press the ‘g’ key to view what packages will be installed and press ‘g’ again to begin downloading and installing. Wait a bit (for various definitions of bit) for all packages to finish download and install. When it’s all said and done it will be prompted to press return to continue. This will bring you back into aptitude, from which pressing ‘q’ will quit. The updates we installed included a new kernel which requires a reboot, so go ahead and do this at the console.
Once the Pi has rebooted start up the graphical user interface by entering the following:
But if it’s not directly connected to Monitor, then just with SSH should connect to Raspberry Pi and then install VNC Server. To Install TightVNC server package use this command:
apt-get install tightvncserver
for the first run of VNC Server to generate configuration files and VNC password enter:
It started an X session on display port 1, note that by default VNC Server will attempt to start on display 0 which is already taken by the started Kali session used for local access
The first time after run VNC Server, it prompts for a password (8 char max). That’s when VNC sessions are not linked to Linux user authentication but relies on a single password (one of VNC insecurity problems). It is possible later change that password using the vncpasswd command.
to check the VNC Server is running by issuing the netstat -tupln command:
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN Xtightvnc
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN Xtightvnc
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN sshd
Port 5901 is VNC connection port, 6001 is X server for VNC.