A Raspberry Pi 3 Based Hacking Machine


What is a Raspberry Pi? 

Raspberry Pi is a single-board microcomputer. It is highly customisable and is capable of running a wide range of operating systems. Since there is a variety of modules available for purchase, the Raspberry Pi may be used for other purposes, such as making a radio station, GPS tracker, and many other custom projects. It is also possible to build a custom module, however it takes time and extensive knowledge of both hardware and software to make sure the module doesn’t suffer from compatibility issues. 



What is Kali Linux? 

Kali is a flavour of Linux designed for pentesting and digital forensics. It comes with a variety of tools that allow us to exploit the vulnerabilities of a system. This OS is available for free, you can find more information here: 




Introduction 

This project aims to create a hacking machine using a Raspberry Pi 3 device with a version of Kali Linux that is compatible with ARM devices. The whole system consists of a 7” screen, a wireless keyboard, and a microSD card. In addition to these, you may buy a power bank for your device if you wish. Here is the complete list of physical components, all of them available at ModMyPi – the best Raspberry Pi vendor that ships worldwide (and you may pay with your local currency or crypto). This list is for guidance purposes only, you may find parts at a cheaper price. You may already have some of these in possession so be sure to follow a checklist. 

Must have components:
  • Raspberry Pi 3 Model B
  • Class 10 MicroSD card with a capacity of at least16GB (be sure it is a Class 10)
  • A microSD adaptor
    • This is an excellent product which I have been using (both SD and microSD compatible and can be connected to smartphones)
  • 5.1V 2.5A power supply (preferably an official release)
  • Heat Sink kit
  • HDMI Cable 
  • A basic Raspberry Pi case 
You may find these in a bundle (costing £54.99) or you can buy them separately.

You may purchase the 7” screen here (costing £59.99), and the wireless keyboard (with touchpad) here (£21.99) 



Optional:

I recommend the official case because it makes all the ports accessible – although replacing the microSD is a pain (more on this at the end of this article).

Alternatives:
You can use a PiTFT screen, a 3.5" display with a resolution of 480x320. It is difficult to set up however.

The total cost of this project is £151.97 or £153.96, depending on which case you pick. Note that this is compatible with other operating systems (Ubuntu Mate, Raspbian, etc).



Getting Started 

If you bought a starter kit you might find a microSD with a preloaded operating system. Set up your Pi, make sure everything is working as intended – connect to a network and perform a software upgrade using the following commands in the terminal (note: this does not apply if you run Windows IoT): 

sudo apt-get update 
sudo apt-get upgrade 

Once you are convinced that your system is working as intended, shut it down and remove the microSD. If you are using Windows on your main device, the system won’t recognise the storage device – this happens when you install an OS on a microSD. 

Formatting the microSD 

The easiest way to format your microSD is to go to the command prompt and type in the following commands: 

diskpart 
list disk 
select disk n
  • n is the label of the storage device represented as a number. Replace this with the appropriate number.
clean 
create partition primary 
format fs=fat32 quick 
cmddisk


This prepares the microSD so you can install Kali Linux. 



Installing the OS 

Download the ARM compatible version of Kali from here and extract it to a place where you can find it easily (e.g. desktop).
You will also need a program called Win32DiskImager which allows you to easily install an OS on a device. Available for free here.

Three simple steps are required to write the disk image to the microSD: 
  1. Select the image file (this is a recycled image, hence the reason you can see Ubuntu Mate’s image) 
  2. Select the destination – it is crucial you select the correct one, otherwise you can potentially do serious damage to your system. Double check the label of your microSD device. 
  3. Select the option “Write”. 
The process will normally take a few minutes. Once it’s finished you can use it to boot up your Raspberry Pi. Make sure everything is working. 



Setting up the physical components 

This can be tricky for the first time since you want to avoid any damage, but once you get comfortable constructing and deconstructing the device it will be much easier. The 7” touchscreen has everything you need included in its package so you don’t need to make any additional purchases. If you purchase the product from ModMyPi, it will arrive with the board already mounted on the back of the screen. You will need to attach the DSI ribbon cable and jumper wires to the Pi’s board. 

First you want to make sure the microSD is placed in the Pi, otherwise you would have to dismantle the device and build it up again. 

Figure 1
Figure 1 shows the display and its adapter board with the ribbon cable and jumper cables attached. When you attach the ribbon cable, the side with the silver lines should face upward. Once the cable is all the way in you need to pop the black frame into place so the cable would not detach - this is very important. Connect the jumper cables as shown in Figure 2 - each rectangle represents a cable colour. Note that in some cases the blue cable might actually be green. I had a blue one in my kit.

Figure 2
Figure 3

Once that's done, place the Pi on top of the screen's board. Make sure it's held in place by two screws placed in diagonally (no need more than that, they will be removed anyway). When the Pi is fastened, attach the ribbon cable, just like before. The silver lines should be facing toward the USB ports. See Figure 3.

Then you need to attach the jumper cables. Figure 4 shows the correct allocation for each cable.


Figure 4.1





Figure 4.2


At this point the Pi and the screen are set and are able to act as a tablet. The next step is to place the case on, but ensure that all cables are connected properly and you have a microSD with the OS in the Pi. If you have the official case for the screen you need to remove all screws that hold the Pi in place, but do not remove any cables or any other components - just make sure the Pi is loosened. The case is a bit awkward to place on properly because you need to pop the Pi in place and it's very annoying when the Pi sits tight on top of the screen's board. When you put the case on make sure no cable is stuck underneath – take extra care of the ribbon cable. Once you've managed to put the case on, fasten the Pi first then the case with the screws.


First time boot-up

There are two possible inputs for the power supply, it doesn't matter which one you choose, the device will work regardless of your choice. If you stand up your fully constructed device, you should notice the screen is upside down. This is due to poor design. There are a few lines of code that will rotate and invert the screen, there are two methods. One of them rotates the whole screen, the other rotates what is being displayed and inverts the input coordinates of the touchscreen.

Both of these involve editing the config.txt file. Since Kali doesn't have a config file, you need to make one. Open the terminal and type the following commands:

cd /boot
nano config.txt

This will create the config file in the boot directory. You need to copy some text which I shared on my GitHub account. There are two methods that can deal with the screen-related issue.

Method 1
Append the following line:

lcd_rotate=2

It's that simple.

Method 2
Install xinput using the following command

sudo apt-get install xinput

Append the following line to config (similarly to the previous method):

display_rotate=2

You can change the number later, in case you need them in the future here is what they mean:
  • 0 = normal
  • 1 = 90 degrees
  • 2 = 180 degrees
  • 3 = 270 degrees
  • 0x10000 = horizontal flip
  • 0x20000 = vertical flip


Also add the following line to the end of config:

xinput --set-prop 'FT5406 memory based driver' 'Evdev Axis Inversion' 1 1

This method flips the screen and inverts the input coordinates of the touchscreen. Learning this method might prove useful if you decide to work on projects involving displays.



Possible errors

No internet connection: a common error I've encountered not just on Kali, but on other distributions of Linux. To resolve this issue, open the terminal and type:

sudo service network-manager restart

This will restart the network manager and will try to connect to a network if you have specified one previously.

Other errors such as crashes or freezes may be very specific, you would have to look for solutions on the internet.








Comments