Setup Kali Linux In Raspberry Pi And Android Device As Screen & Input
Before we begin, Let me give you an introduction about what is inside this article. as the title said it is all about Raspberry Pi, a Raspberry Pi is a low budget (30$), small credit-card sized ARM board that acts as a computer, and it can connect to TV, Laptop screen and desktop monitor. The Pi is popular among hobbyists and educators due to its low cost, simplicity, and versatility of applications, So how it will useful for Penetration testing or Ethical hacking by installing hacker’s OS Kali Linux on it. well, this complete step by step guide will teach you how to install Kali linux in Rapberry Pi and how to use an Android device as its screen and input.
What is Raspberry Pi?
What’s more, the Raspberry Pi has the ability to interact with the outside world, and has been used in a wide array of digital maker projects, from music machines and parent detectors to weather stations and tweeting birdhouses with infra-red cameras. We want to see the Raspberry Pi being used by kids all over the world to learn to program and understand how computers work.
Installing Kali Linux 1.1.0 on the Raspberry Pi 2
There is no official Kali support for the Raspberry Pi 2 with working images, and Kali 1.1.0 support, I wanted to find out if it was possible to get Kali 1.1.0 working on the latest Raspberry Pi 2 and the steps needed.
The Raspberry Pi 2 is small and low powered enough to be used as a penetration testing “drop box”. It’s a simple but fairly powerful device that can be inconspicuously plugged into a network and provide a penetration tester with the means to perform remote tests.
Raspberry PI 2
The Raspberry PI 2 has significantly improved specifications compared to the Raspberry PI model B+, being approximately six times faster and having twice the memory.
The quick specifications are:-
900MHz quad core ARM Cortex-A7 CPU (~6x performance)
4 port USB
10/100 Ethernet port.
Kali Linux 1.1.0 was released on the 9/2/2015, and was described as a milestone release. With a new kernel patched for Wireless injection attacks, and improved wireless driver support.
Building a Kali Linux 1.10 image for the Raspberry Pi 2
And slightly modified the workflow to the below:-
git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7
git clone https://github.com/offensive-security/kali-arm-build-scripts
Then download the Raspberry Pi 2 kernel configuration, to the current folder (kali-arm-build-scripts) using the following command:-
wget http://pastebin.com/download.php?i=Rv3zpsiv -O pi2_kernel.config
Then modify the rpi.sh script as below:-
Replacing “armel” above with “armhf” as below, as the Raspberry PI uses the armhf architecture.
Then continue to modify the rpi.sh file to load the new kernel configuration as below, and then save the modified rpi.sh to disk. (with vi :wq).
And built the image using version 1.1.0 of Kali Linux:
The image file kali-1.1.0-rpi.img,xz was produced:-
For the next steps i am used a Windows laptop with a built in SD card reader, to write the created img to a high capacity SDHC card.
Extract the xz file to an img file using the Windows 7-zip program, and then use “Win32 Disk Imager” to write the img to the SDHC card.
Configuring Kali Linux on the Raspberry Pi 2.
Expanding the image to the size of the flash card
Insert the written SDHC card in the Raspberry Pi 2, and made the other necessary connections like attaching a keyboard/monitor/mouse and plugging a DHCP enabled network cable into the Raspberry Pi. And then powered the Raspberry Pi up, logging in using the default credentials root/toor:- (we suggest changing the password).
As i wanted to use the full flash SD card size, as the full kali Linux build which i want to install is too big for the default image, So i am then expanded the image to the full size of the flash SD card, using the following commands :
However the sudo and parted programs were missing, so we had to use apt-get to install them:-
apt-get install sudo
apt-get install parted
Then the rpi-wiggle.sh program was able to run:-
After this the Raspberry Pi will be reboot, Now ready for the full Kali build to be installed.
Installing the Full Kali Linux build
Now it is time to install the full Kali Linux build, by issuing the following commands:-
apt-get install kali-linux-full
After downloading and installing files, and answering a number of configuration screens, the installation will be completed and the command prompt will display:
Installing and configuring the SSH server
The next step is install and configure the SSH server. Though chkconfig first:
apt-get install chkconfig
Then remove the run levels for SSH:
update-rc.d -f ssh remove
And then load the SSH defaults to run level:
update-rc.d -f ssh defaults
Next, check that the SSH server was up and running:
I suggest removing the default keys for the SSH server:
Then create a new set of public and private keys:
Now restart the SSH server:
service ssh restart
You are done.
Note: I am used a SDHC for compatibility sake, which limited me to a maximum capacity of 32GB. Where possible select cards which have wear levelling, which distributes the writes across the memory, extending the life of the flash media. Finally i am used high speed media, selecting manufacturers from a published Raspberry Pi compatibility guide http://elinux.org/RPi_SD_cards
Use Android Device as Screen and Input for Raspberry Pi
Got an Android device? Want to use it as a screen and keyboard for Raspberry Pi? A simple trick described in a thread on the Raspberry Pi forum site can help you with that.
For this trick to work, you need an Android device that supports USB tethering and VX ConnectBot app installed on it.
What this does:
1. Allows you to use your Android device as keyboard input and terminal display for your Raspberry Pi
2. Allows you to tether your Raspberry PI to your Android device’s WiFi (3G untested, but should work).
- Your PI is configured to run SSHd on startup
- You are using the default Pi username / password
- Your Android device has internet connectivity via WiFi/3G and it is enabled
How to do it:
On Raspberry Pi, run the sudo nano /etc/network/interfaces command, and add the following configuration to it:
iface usb0 inet static address 192.168.42.42 netmask 255.255.255.0 network 192.168.42.0 broadcast 192.168.42.255
This effectively turns the first USB port into a network interface. Reboot Raspbery Pi.
2. Connect your Android device to your Pi via it’s USB data cable
3. Power up your Pi… wait about a minute.
4. On your Android device, go to Settings / Wireless & Networks / More / Tethering & Portable Hotspot… click “USB tethering“
5. Start up VX ConnectBot and SSH “email@example.com“
6. Keep hitting return until it asks you for your password. Enter it.
Congratulations – you should now have terminal access to your Pi with a software keyboard… kinda. Mine seems to disconnect the session every minute or so – very annoying.
Now to set up routing so that your Pi can see the world via your Android device.
7. Root yourself up
8. Check to see which IP address that your Android device is using
mine is 192.168.42.129
9. Add a default route pointing all traffic from your Pi out to your Android device. It’s worth noting that this static route is temporary and will not survive rebooting your Pi. I’ve left it like this because I don’t know if Android likes to change it’s tether gateway address very often.
10. Test it!
Top Android Apps For Advanced Usability With Raspberry Pi
Ever found yourself plugging a keyboard into your Raspberry Pi because you could be bothered to boot your PC to SSH, or found yourself desperately trying to remember the tiny computer’s IP address on your network?
There are a whole host of Android utilities that can be used by Raspberry Pi owners to make life easier, including a couple that are custom designed.
I have collected some of them together, all of which are free to install to Android phones and tablets.
The standard Android keyboard isn’t really any good for entering command line instructions (something you’ll probably need to do if connecting over SSH to your Raspberry Pi device) which is where the Hacker’s Keyboard comes in handy. Arguably more useful on devices with a larger screen or tablets, this app offers a standard keyboard layout for Android, with all of the characters — alpha-numeric and punctuation — where you would expect to find them.
Also featuring Tab, Ctrl, Esc, and arrow keys, Hacker’s Keyboard will probably prove vital for communicating with your Pi from your Android phone or tablet. At the very least it should save you some time. Many international keyboard layouts are included, while the developer has also provided international dictionaries as optional plugins should you wish to use Hacker’s Keyboard more widely.
Rather than sending files by FTP or gaining command line access through SSH, what if you needed to setup a remote connection to the GUI in Raspbian or some other Pi distro?
To start with, you would need to have TightVNC installed on your Raspberry Pi. This will accept the connection, but to get a reproduction of your Raspberry Pi desktop on your Android device, you’ll need AndroidVNC.
With a keyboard and a settings screen to manage how the mouse behaves and to send special keys (such as CTRL-ALT-DEL), AndroidVNC simplifies what might otherwise be a complicated mess of options. Not so great for smaller screens, AndroidVNC is perfect for phablets and tablets.
- You’ve just switched on your Raspberry Pi but you forgot to connect the HDMI lead, so you have no display. You don’t want to pull the plug, but you can’t ssh into it without the ip address. How to find it? Or…
- You got your headless Raspberry Pi up and running, but you forgot what ip address it’s on. Or…
- You rebooted your internet router and it’s changed the ip address of the Pi. What do you do?
You install Fing on your phone and use it to scan your whole network and tell you the ip and mac addresses of every connected device.
Very useful indeed. There’s no looking back once you’ve got Fing installed. It’s a superb app. You can assign names to each device and choose an appropriate icon to make identification easier. They recently added a Raspberry Pi icon too…