Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Penetration Testing with Raspberry PI
Penetration Testing with Raspberry PI

Penetration Testing with Raspberry PI: Construct a hacking arsenal for penetration testers or hacking enthusiasts using Kali Linux on a Raspberry Pi

eBook
$9.99 $19.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Penetration Testing with Raspberry PI

Chapter 2. Preparing the Raspberry Pi

The Raspberry Pi should be considered an underpowered platform for security assessments. This is because it has been designed as a low-cost, portable computer primarily targeting educationalists and hobbyists. This open platform may be limited in computing power, but it does provide many powerful use cases that security professionals can leverage for penetration testing and other service engagements. The focus of this chapter will be on how to prepare a Raspberry Pi running Kali Linux (or other platforms) for a penetration test.

The following topics will be covered in this chapter:

  • Raspberry Pi use cases
  • The Command and Control server
  • Preparing for a penetration test
  • Overclocking
  • Setting up wireless cards
  • Setting up a 3G USB modem with Kali Linux
  • Setting up the SSH service
  • SSH default keys and management
  • Reverse shell through SSH
  • Stunnel
  • Wrapping up with an example

Raspberry Pi use cases

Raspberry Pi is a common requirement for security professionals to gather information from remote sites in large distributed organizations. Many people leverage commercial tools that specialize in vulnerability assessments for this situation; however, you may not have access to such tools due to a limited budget or vendor partnership requirements. An example of this situation is when the authors of this book had to take part in a security assessment that included multiple locations all over the world. For this project, it was not feasible to travel to every location to deliver local penetration testing services. To overcome this, we sent Raspberry Pi devices configured with Kali Linux to each location and remotely assessed the network for vulnerabilities at a very affordable price. We will cover this engagement example in more detail at the end of this chapter.

Another valuable use case for a Raspberry Pi is when a security professional wants to leave a device on...

The Command and Control server

As we have stated in other chapters, the Raspberry Pi is not a powerful machine. To overcome this weakness, it is best practice to capture data in a controlled manner or leverage offline computing when using Kali Linux on a Raspberry Pi. We found that not doing so would either overwhelm the processors when using most of the attack tools or quickly consume the limited local storage space when viewing captured data. We will cover filtering captured data in Chapter 3, Penetration Testing, under the Tuning your network capture section.

When planning to remotely access multiple Raspberry Pi systems, we recommend setting up a central Command and Control (C&C) server rather than accessing each box individually. The C&C server should be a more powerful system such as a traditional server so it can focus on CPU intensive tasks such as breaking passwords through brute force. More importantly, tasks can also include using the C&C server to perform the actual...

Preparing for a penetration test

The Kali Linux ARM image we covered in Chapter 1, Raspberry Pi and Kali Linux Basics, has already been optimized for a Raspberry Pi. We found however that it is recommended to perform a few additional steps to ensure you are using Kali Linux in the most stable mode to avoid crashing the Raspberry Pi. The steps are as follows:

  1. The first recommended step is to perform the OS updates as described in detail in Chapter 1, Raspberry Pi and Kali Linux Basics. We won't repeat the steps here, so if you have not updated your OS, please go back to Chapter 1, Raspberry Pi and Kali Linux Basics, and follow the instructions.
  2. The next step you should perform is to properly identify your Raspberry Pi. The Kali Linux image ships with a generic hostname. To change the hostname, use the vi editor (although feel free to use any editor of your choice; even if you are a fan of nano, we won't judge you much) with the vi /etc/hostname command as shown in the following screenshot...

Overclocking

Overclocking the Raspberry Pi can improve the performance. The risk of doing this can also greatly reduce the life of the hardware. Overclocking may require more power from the Raspberry Pi, so if you are powering it from a weak power source, overclocking could cause issues. We have had some problems resulting in what appears to be corruption in microSD cards and operating systems when overclocking the Raspberry Pi.

Note

Only overclock the Raspberry Pi if you can accept the risk that you may permanently damage your system.

To overclock the Raspberry Pi, you can use the raspi-config application for advanced hardware manipulation. Unfortunately, this application does not come with the Kali Linux image and requires some configuration. Don't worry; we have made the following steps pretty easy for you to follow. They are:

  1. From your Raspberry Pi command line, type:
    wget http://www.drchaos.com/wp-content/uploads/2014/09/raspberry_pi_overclock_files.zip
    

    Tip

    You can also use the official...

Setting up wireless cards

When you purchase a Wi-Fi adapter for your Raspberry Pi, you want to make sure it not only works with the Raspberry Pi, but also works with Kali Linux. Luckily, almost every Wi-Fi adapter we used works with both the Raspberry Pi and Kali Linux. In this book, we are using the CanaKit Wi-Fi dongle, as shown in the following image:

Setting up wireless cards

CanaKit makes an extremely popular Raspberry Pi kit that ships with this version of the Wi-Fi adapter. You can also purchase an adapter separately. If you need to purchase a separate card, make sure it is one that works with Debian Linux.

Tip

A good resource for compatible cards is http://elinux.org/RPi_USB_Wi-Fi_Adapters.

Once you connect your Wi-Fi adapter, you should first verify that the system shows it is functioning properly. You can do this by issuing the iwconfig command in a terminal window as shown in the following screenshot:

Setting up wireless cards

You should see a wlan0 interface representing your new wireless interface. The next step is to enable the...

Raspberry Pi use cases


Raspberry Pi is a common requirement for security professionals to gather information from remote sites in large distributed organizations. Many people leverage commercial tools that specialize in vulnerability assessments for this situation; however, you may not have access to such tools due to a limited budget or vendor partnership requirements. An example of this situation is when the authors of this book had to take part in a security assessment that included multiple locations all over the world. For this project, it was not feasible to travel to every location to deliver local penetration testing services. To overcome this, we sent Raspberry Pi devices configured with Kali Linux to each location and remotely assessed the network for vulnerabilities at a very affordable price. We will cover this engagement example in more detail at the end of this chapter.

Another valuable use case for a Raspberry Pi is when a security professional wants to leave a device on-site...

The Command and Control server


As we have stated in other chapters, the Raspberry Pi is not a powerful machine. To overcome this weakness, it is best practice to capture data in a controlled manner or leverage offline computing when using Kali Linux on a Raspberry Pi. We found that not doing so would either overwhelm the processors when using most of the attack tools or quickly consume the limited local storage space when viewing captured data. We will cover filtering captured data in Chapter 3, Penetration Testing, under the Tuning your network capture section.

When planning to remotely access multiple Raspberry Pi systems, we recommend setting up a central Command and Control (C&C) server rather than accessing each box individually. The C&C server should be a more powerful system such as a traditional server so it can focus on CPU intensive tasks such as breaking passwords through brute force. More importantly, tasks can also include using the C&C server to perform the actual...

Preparing for a penetration test


The Kali Linux ARM image we covered in Chapter 1, Raspberry Pi and Kali Linux Basics, has already been optimized for a Raspberry Pi. We found however that it is recommended to perform a few additional steps to ensure you are using Kali Linux in the most stable mode to avoid crashing the Raspberry Pi. The steps are as follows:

  1. The first recommended step is to perform the OS updates as described in detail in Chapter 1, Raspberry Pi and Kali Linux Basics. We won't repeat the steps here, so if you have not updated your OS, please go back to Chapter 1, Raspberry Pi and Kali Linux Basics, and follow the instructions.

  2. The next step you should perform is to properly identify your Raspberry Pi. The Kali Linux image ships with a generic hostname. To change the hostname, use the vi editor (although feel free to use any editor of your choice; even if you are a fan of nano, we won't judge you much) with the vi /etc/hostname command as shown in the following screenshot:

    The...

Overclocking


Overclocking the Raspberry Pi can improve the performance. The risk of doing this can also greatly reduce the life of the hardware. Overclocking may require more power from the Raspberry Pi, so if you are powering it from a weak power source, overclocking could cause issues. We have had some problems resulting in what appears to be corruption in microSD cards and operating systems when overclocking the Raspberry Pi.

Note

Only overclock the Raspberry Pi if you can accept the risk that you may permanently damage your system.

To overclock the Raspberry Pi, you can use the raspi-config application for advanced hardware manipulation. Unfortunately, this application does not come with the Kali Linux image and requires some configuration. Don't worry; we have made the following steps pretty easy for you to follow. They are:

  1. From your Raspberry Pi command line, type:

    wget http://www.drchaos.com/wp-content/uploads/2014/09/raspberry_pi_overclock_files.zip
    

    Tip

    You can also use the official...

Setting up wireless cards


When you purchase a Wi-Fi adapter for your Raspberry Pi, you want to make sure it not only works with the Raspberry Pi, but also works with Kali Linux. Luckily, almost every Wi-Fi adapter we used works with both the Raspberry Pi and Kali Linux. In this book, we are using the CanaKit Wi-Fi dongle, as shown in the following image:

CanaKit makes an extremely popular Raspberry Pi kit that ships with this version of the Wi-Fi adapter. You can also purchase an adapter separately. If you need to purchase a separate card, make sure it is one that works with Debian Linux.

Tip

A good resource for compatible cards is http://elinux.org/RPi_USB_Wi-Fi_Adapters.

Once you connect your Wi-Fi adapter, you should first verify that the system shows it is functioning properly. You can do this by issuing the iwconfig command in a terminal window as shown in the following screenshot:

You should see a wlan0 interface representing your new wireless interface. The next step is to enable the interface...

Setting up a 3G USB modem with Kali Linux


You can use 3G USB modem cards with Kali Linux and connect to your Raspberry Pi over cellular for stealthy remote access. Each card is manufactured a little differently, and therefore the setup may vary based on the type of 3G card and service provider. Our recommendation is using a MiFi (short for Mobile Wi-Fi) hotspot and connecting Kali Linux through a Wi-Fi adapter; however, if you want to use a 3G USB modem, make sure you verify it works with Debian.

In our next example, we use the Huawei 3G USB modem connect card. This is a 3G GSM card that works with most frequencies around the globe.

Here are the steps to set up this card:

  1. Open up a terminal window and type in the following command:

    wget http://www.ziddu.com/download/22764375/3gusbmodem.zip.html
    
  2. Unzip the file issuing the unzip command.

  3. Make changes in the directory you just unzipped.

  4. Make the file an executable by typing in chmod +x 3gusbm*.

  5. Run the script by typing ./3gusbmodem –interactive.

  6. The...

Setting up the SSH service


The Secure Shell (SSH) gives you full access to the Kali Linux operating system on a Raspberry Pi from a remote location. It is the most common way to manage Linux systems using a command line. Since the Kali Linux GUI is not needed for most penetration testing exercises, we recommend that you use SSH or command-line utilities whenever possible. We found some installations of Kali Linux have SSH enabled while others may need you to install the OpenSSH server.

You should first verify whether the SSH service is installed. Type in the service --status-all command to check whether the SSH service is running. If you see + as shown in the following screenshot, you are good to go. If you see a - sign, then you will need to install the OpenSSH server.

To install the OpenSSH server, open a command-line terminal and type apt-get install openssh-server to install the SSH services. You will need to start the SSH services by issuing the service ssh start command as shown in the...

SSH default keys and management


At this point, you have a Raspberry Pi ready for remote management using SSH. This is good; however, the keys that are installed by default are extremely predictable with every other default installation for OpenSSH. Although this is optional, best practice is changing the default keys. After all, it would be embarrassing if your penetration testing machine got hacked.

Here are the steps to create a new SSH key for your Kali Linux system:

Note

Make sure you use a keyboard and console for the following steps. Do not attempt to perform the following steps over an existing SSH session.

  1. Move the default SSH keys by typing the following into the terminal or command line:

    cd /etc/ssh/
    mkdir default_kali_keys
    mv ssh_host_* default_kali_keys/
    
  2. Generate a new key by using the following command and watching the prompts:

    dpkg-reconfigure openssh-server
    Creating SSH2 RSA key; this may take some time ...
    Creating SSH2 DSA key; this may take some time ...
    Creating SSH2 ECDSA...
Left arrow icon Right arrow icon

Description

If you are looking for a low budget, small form-factor remotely accessible hacking tool, then the concepts in this book are ideal for you. If you are a penetration tester who wants to save on travel costs by placing a low-cost node on a target network, you will save thousands by using the methods covered in this book. You do not have to be a skilled hacker or programmer to use this book. It will be beneficial to have some networking experience; however, it is not required to follow the concepts covered in this book.

Who is this book for?

If you are looking for a low budget, small form-factor remotely accessible hacking tool, then the concepts in this book are ideal for you. If you are a penetration tester who wants to save on travel costs by placing a low-cost node on a target network, you will save thousands by using the methods covered in this book. You do not have to be a skilled hacker or programmer to use this book. It will be beneficial to have some networking experience; however, it is not required to follow the concepts covered in this book.

What you will learn

  • Install and tune Kali Linux on a Raspberry Pi for hacking
  • Use a Raspberry Pi for pentests such as breaking wireless security, scanning networks, and capturing sensitive data
  • Perform maninthemiddle attacks and bypass SSL encryption
  • Compromise systems using various exploits and toolkits
  • Bypass security defenses and remove data off a target network
  • Develop a command and control system to manage remotely placed Raspberry Pis
  • Turn a Raspberry Pi into a honeypot to capture sensitive information
  • Grasp professional penetration testing through proper documentation

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 27, 2015
Length: 208 pages
Edition : 1st
Language : English
ISBN-13 : 9781784394127
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 27, 2015
Length: 208 pages
Edition : 1st
Language : English
ISBN-13 : 9781784394127
Category :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 108.97
Raspberry Pi for Secret Agents - Second Edition
$26.99
Kali Linux: Wireless Penetration Testing Beginner's Guide, Second Edition
$48.99
Penetration Testing with Raspberry PI
$32.99
Total $ 108.97 Stars icon
Banner background image

Table of Contents

7 Chapters
1. Raspberry Pi and Kali Linux Basics Chevron down icon Chevron up icon
2. Preparing the Raspberry Pi Chevron down icon Chevron up icon
3. Penetration Testing Chevron down icon Chevron up icon
4. Raspberry Pi Attacks Chevron down icon Chevron up icon
5. Ending the Penetration Test Chevron down icon Chevron up icon
6. Other Raspberry Pi Projects Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6
(12 Ratings)
5 star 83.3%
4 star 0%
3 star 8.3%
2 star 8.3%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Zulu_Man Feb 06, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
You don't know a single thing about Rasberry Pi B+ and Pen Testing? This book is an awesome write and works in a chronological order. Starts from the very basic and guides you to advanced techniques. I highly recommend this! $10 for Kindle edition??? How can it not be worthy? Lol. Go buy it!
Amazon Verified review Amazon
Peter Dec 04, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Good
Amazon Verified review Amazon
Cristian Gradisteanu Mar 14, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is a great book on how to use this powerful little device for pen testing. It gives you the tools of the trade and the power of such a low consumption device to have your arsenal with you all the way. As a pen tester you will love this book!
Amazon Verified review Amazon
Aldhissla Sep 29, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
this book is amost the same of the book "penetration testing w/ kali linux"perfect book w/ explication for the raspberry
Amazon Verified review Amazon
Christophe21 Nov 20, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Si vous souhaitez utiliser votre Raspberry sur d'autres projets que les projets classiques, l'idée de profiter de la petite taille de cet ordinateur pour jouer au "man in the middle" sur un réseau (où vous êtes autorisé à pénétre...), ce livre est fait pour vous. Bien évidemment, les techniques proposées par l'ouvrage sont adaptées à la puissance du Raspberry, et donc pas nécessairement très performantes, mais cet ouvrage vous permettra de comprendre, à moindres frais, les rudiments des tests de pénétration. L'ouvrage est très pédagogique.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.