Penetration Testing with Raspberry Pi. - Michael McPhee - E-Book

Penetration Testing with Raspberry Pi. E-Book

Michael McPhee

0,0
31,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

This book will show you how to utilize the latest credit card sized Raspberry Pi 3 and create a portable, low-cost hacking tool using Kali Linux 2.

You’ll begin by installing and tuning Kali Linux 2 on Raspberry Pi 3 and then get started with penetration testing. You will be exposed to various network security scenarios such as wireless security, scanning network packets in order to detect any issues in the network, and capturing sensitive data. You will also learn how to plan and perform various attacks such as man-in-the-middle, password cracking, bypassing SSL encryption, compromising systems using various toolkits, and many more. Finally, you’ll see how to bypass security defenses and avoid detection, turn your Pi 3 into a honeypot, and develop a command and control system to manage a remotely-placed Raspberry Pi 3.

By the end of this book you will be able to turn Raspberry Pi 3 into a hacking arsenal to leverage the most popular open source toolkit, Kali Linux 2.0.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 305

Veröffentlichungsjahr: 2016

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Penetration Testing with Raspberry Pi - Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Choosing a Pen Test Platform
Hardware options and why the Pi
Software option and why Kali
Purchasing a Raspberry Pi
Assembling a Raspberry Pi
Installing Kali Linux
Combining Kali Linux and the Raspberry Pi
Cloning the Raspberry Pi SD card
Avoiding common problems
Summary
2. Preparing for Battle
The Command and Control server
Preparing for a penetration test
Setting up the SSH service
SSH default keys and management
Reverse shell through SSH
SSL tunnelling
stunnel
Server
Client
ncat
ptunnel and other techniques
Using the GUI
Transporting X via SSH
VNC and RDP
Overclocking
Setting up the wireless interface
Setting up the Bluetooth interface
Setting up a 3G or 4G modem
Wrapping it up with an example
3. Planning the Attack
Understanding the Cyber or Intrusion Kill Chain
Reconnaissance
Weaponization
Delivery
Exploitation
Installation
Command and Control
Actions
Preparing for the penetration test
Common tools for web, wired, and wireless attacks
Mapping our tools to the Penetration test Kill Chain
Addition of non-standard tools to arsenal
Positioning the Pi
Summary
4. Explore the Target - Recon and Weaponize
Prospecting the target
Network scanning
Seeing and cracking Wi-Fi
Obtaining the key
Cracking the key
Capturing and cracking passwords
Online cracking
Offline cracking
Getting data to the Pi
Physically inline option
Software based approach
arpspoof (Part of dsniff)
Ettercap
Wireshark
dsniff
Firewalk
Tuning our network capture
Scripting tcpdump for future access
Web application hacks
DotDotPwn
Driftnet
W3af
Summary
5. Taking Action - Intrude and Exploit
Using the Metasploit framework to exploit targets
Getting Recon data into Metasploit
Scoping vectors and launching attacks
Rolling our own exploits
Wrapping payloads
Social engineering
The Social-Engineer Toolkit
Phishing with BeEF
Executing man-in-the-middle attacks
SSLstrip
parasite6
Manipulating data
Sniffing the network in Scapy
Writing/reading PCAP files
Creating/sending/receiving of packets
Creating and sending malformed packets
TCP SYN scan
Rogue Access honeypot (revising and re-shooting)
Easy-creds
Bluetooth testing
Bluelog
Blueranger
Btscanner
Connecting to Bluetooth device using bluetoothctl
Summary
6. Finishing the Attack - Report and Withdraw
Covering our tracks
Wiping logs
Masking our network footprint
Using ProxyChains
Clearing the data off the Raspberry Pi
Developing reports
Collecting and correlating testing data
Creating screenshots
Using ImageMagick
GIMP, Screenshot, and Shutter
Moving data
Compressing files with Zip/Unzip
Using File Roller
Using split
Summary
7. Alternative Pi Projects
Diving into PwnPi
Discovering Raspberry Pwn
Investigating PwnBerry Pi
Defending your network
Intrusion detection and prevention
Exploring Snort
Content filtering
GateSentry as a content filtering option
Remote access with OpenVPN
Server installation
Server Certificate Authority setup
Server configuration and startup
Client-Configuration and Startup
Tor networking
Raspberry Tor
Tor Exit node or router
Running Raspberry Pi on your PC with QEMU emulator
Running Windows 10 on Raspberry Pi 3
Other popular use cases for the Raspberry Pi
Raspberry Weather
PiAware
PiPlay
PrivateEyePi
Summary

Penetration Testing with Raspberry Pi - Second Edition

Penetration Testing with Raspberry Pi - Second Edition

Copyright © 2016 Packt

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt cannot guarantee the accuracy of this information.

First published: January 2015

Second edition: November 2016

Production reference: 1231116

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham 

B3 2PB, UK.

ISBN 978-1-78712-613-8

www.packtpub.com

Credits

Authors

Michael McPhee

Jason Beltrame

Copy Editors

Safis Editing

Dipti Mankame

Reviewers

Joseph Muniz

Aamir Lakhani

Project Coordinator

Judie Jose

Commissioning Editor

Pratik Shah

Proofreader

Safis Editing

Acquisition Editor

Vijin Boricha

Indexer

Pratik Shirodkar

Content Development Editor

Rashmi Suvarna

Graphics

Kirk D'Penha

Technical Editor

Aditya Khadye

Production Coordinator

Deepika Naik

About the Authors

Michael McPhee is a Systems Engineer working for Cisco, based in Upstate NY, where he has worked for 4 years. Prior to joining Cisco, Michael spent 6 years in the U.S. Navy and another 10 working on communications systems, and has obtained the following certifications along the way: CCIE R&S, CCIE Security, CCIP, CCDP, ITILv3, and the Cisco Security White Belt. He has a BS in Electrical Engineering Technology from Rochester Institute of Technology and a Masters of Business Administration from University of Massachusetts - Amherst.

Michael's current role sees him consulting on security and network infrastructures. Before joining Cisco, Michael was a Network Operations Team Lead at a major regional insurance company. Prior to entering IT, he spent 11 years as a systems engineer and architect for defense contractors, where he helped propose, design, and develop command and control and electronic warfare systems for the US DoD and NATO allies. Michael’s diverse experience helps customers keep things in perspective and achieve their goals securely.

I want to thank my family, especially my wife Cathy for all of her unwavering love and support, and for always letting me tackle new things, and for helping me raise our funny, witty, and wonderfully nutty children, Liam and Claire. Go to bed, kids! I would also like to thank my teammates and shipmates, past and present - you all have helped to make me who I am as an engineer and more, and you’ve all set some pretty high bars for me to aspire to. To my Cisco mentors, folks like Dave Nentarz, Chad Hintz, Jason Vierra, and so many others – your generosity with your time, encouragement, and wisdom has been invaluable. Joey and Aamir, thank you for trusting us with this awesome project – we’ve learned a ton! Finally folks, Jason Beltrame is about the best teammate and friend a guy could take this journey with, and I appreciate all of his patience, positivity, and comradery. 

Jason Beltrame is a Systems Engineer for Cisco, living in the Eastern Pennsylvania Area. He has worked in the Network and Security field for 18 years, with the last 2 years as a Systems Engineer, and the prior 16 years on the operational side as a Network Engineer. During that time, Jason has achieved the following certifications: CISSP, CCNP, CCNP Security, CCDP, CCSP, CISA, ITILv2, and VCP5. He is a graduate from DeSales University in BS in Computer Science. He has a passion for security and loves learning.

In his current role at Cisco, Jason focuses on Security and Enterprise Networks, but as a generalist SE, he covers all aspects of technology. Jason works with commercial territory customers, helping them achieve their technology goals based on their individual business requirements. His 16 years of real-world experience allows him to relate with his customers and understand both their challenges and desired outcomes.

I would like to thank my wife, Becky, for putting up with my late night writing sessions, as well as giving me the support needed to write this book. I would also like to thank both my children, Josh and Ryan, for keeping me active and giving me the strength to stay up late writing and researching.  Without this strong support system that I have, none of this would have been possible. Follow colleagues/mentors such as Michael McPhee, Joseph Muniz and Aamir Lakhani for pushing me to do my best and believing in me.

About the Reviewers

Joseph Muniz is an architect at Cisco Systems and a security researcher. He has extensive experience in designing security solutions and architectures for the top Fortune 500 corporations and the US Government. Joseph's current role gives him visibility into the latest trends in cyber security, both from leading vendors and customers. Examples of Joseph’s research is his RSA talk titled Social Media Deception quoted by many sources found by searching Emily Williams Social Engineering, as well as articles in PenTest Magazine regarding various security topics. 

Joseph runs The Security Blogger website, a popular resource for security and product implementation. He is the author and contributor of several publications, including a recent Cisco Press title focused on building a Security Operations Center (SOC). Follow Joseph at http://www.thesecurityblogger.com/ and @SecureBlogger.    

Outside of work, Joseph can be found behind turntables scratching classic vinyl or on the soccer pitch hacking away at the local club teams.   

Publications:

CCNA Cyber Ops SECOPS #210-255 Official Cert Guide (Certification Guide) – Cisco Press CCNA

Cyber Ops SECFND #210-250 Official Cert Guide (Certification Guide) – Cisco Press Security

Operations Center: Building, Operating, and Maintaining your SOC – Cisco Press

Penetration Testing with Raspberry Pi - Packt Publishing                                                    

Web Penetration Testing with Kali Linux - Packt Publishing

I will start by thanking Michael and Jason for taking on the daunting task of revising our book. We were extremely picky about who would work on this and it was great having our friends step up and take on this project. We feel really lucky to work with them and love what they came up with.   

Next I want to thank the Packt team for their work on this book. They are professional and really fun to work with.

Finally I would like to give a huge thank you to my friends and family. I feel lucky to know and hang out with such great people. 

Aamir Lakhani  is a leading senior security strategist. He is responsible for providing IT security solutions to major enterprises and government organizations.

Mr. Lakhani creates technical security strategies and leads security implementation projects for Fortune 500 companies. Industries of focus include healthcare providers, educational institutions, financial institutions, and government organizations. Aamir has designed offensive counter-defense measures for the Department of Defense and national intelligence agencies. He has also assisted organizations with safeguarding IT and physical environments from attacks perpetrated by underground cybercriminal groups. Mr. Lakhani is considered an industry leader for creating detailed security architectures within complex computing environments. His areas of expertise include cyber defense, mobile application threats, malware management, Advanced Persistent Threat (APT) research, and investigations relating to the Internet’s dark security movement. He is the author of, or contributor to several books, and has appeared on FOX Business News, National Public Radio, and other media outlets as an expert on cybersecurity.

Writing under the pseudonym Dr.Chaos, Mr. Lakhani also operates the popular security social media blog which is hosted at http://www.drchaos.com/. In its recent list of 46 Federal Technology Experts to Follow on Twitter, Forbes magazine described Aamir Lakhani as a blogger, InfoSec specialist, super hero…and all around good guy.

I would like thank my dad, Mahmood Lakhani, for always believing in me.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www.packtpub.com/mapt

Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Preface

Our focus for this book is to learn how to build and use a low-cost, portable hacking arsenal using the Raspberry Pi 3 and Kali Linux. By the end of the book, we’ll have an extremely flexible penetration testing platform, suitable for penetration testing projects that don’t require applications with high processing power needs. This combination leverages the portability of the Raspberry Pi and the capabilities of the most popular open source penetration toolset, Kali Linux. Throughout the book, we will focus on using the combined platform to perform covert security assessments at remote locations. We will be setting them up for remote management with a minimal footprint to help remain undetected. We will see that combining Kali Linux on a Raspberry Pi 3 can provide us with a flexible, adaptable, low-profile and cost-effective penetration testing platform that can accomplish many test objectives larger platforms cannot.

What this book covers

Chapter 1, Choosing a Pen Test Platform, covers both the hardware and software landscape and contrasts the Raspberry Pi and Kali with the other alternatives, explaining the basics of purchasing and assembly a Pi, and the installation of Kali Linux, to the first prompt.

Chapter 2, Preparing for Battle, starts prepping the Raspberry Pi for pen testing by setting up some services that will be use later in the various phases.

Chapter 3, Planning the Attack, explains the multiple phases of a pen test, the tools available in Kali Linux on the Raspberry Pi 3, and how to position the Pi in preparation for the attack.

Chapter 4, Explore the Target – Recon and Weaponize, shows how to glean information from target environments in order to be as prepared as possible for the pen test.

Chapter 5, Taking Action – Intrude and Exploit, focuses on the actual attack and exploitation phase of the pen test using various tools in Kali Linux on the Raspberry Pi 3.

Chapter 6, Finishing the Attack – Report and Withdraw, explores the process of reporting on and learning from the penetration test, as well as how to sanitize the Pi and return the systems to normal operation.

Chapter 7, Alternative Pi Projects, discusses other distribution options for the Raspberry Pi 3, including running the Pi on a PC with Qemu. We will also talk about changing from an offensive security use of the Raspberry Pi 3 to a defensive one, by protecting our own network. Finally, we will explore other popular use cases for the Raspberry Pi 3.

What you need for this book

We definitely recommend having a Raspberry Pi 3 to be able to practice and implement the concepts and examples we are going to show in this book. We do discuss in Chapter 1, Choosing a Pen Test Platform, how to purchase a Raspberry Pi as well as how to configure the other system components that are required for topics in other chapters. Additional Bluetooth and Wireless network adapters may be needed as well, and are discussed in the relevant sections.

Kali Linux and the other software applications referenced in this book are open source, meaning they are free to download.  The hardware and software is not required if you are looking to just follow the concepts covered within this book.

Who this book is for

This book is designed to take a Raspberry Pi and turn it into a hacking arsenal by leveraging the most popular open source penetration toolset – Kali Linux. If you are a computer enthusiast who wants to learn advanced hacking techniques using the low-cost Raspberry Pi 3 as your penetration testing toolbox, or even a seasoned penetration tester just trying to save costs on travel and hardware, then this book is for you. You do not need to be a skilled hacker or programmer to use this book. Prior knowledge of networking and Linux would be an advantage; however, it is not required to follow the concepts covered in this book.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, path names, dummy URLs, user input, and Twitter handles are shown as follows: "For Windows, we can use  Win32DiskImager."

Any command-line input or output is written as follows:

xz –d kali-2.1.2-rpi2.img.xz

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Click on Write, and let it do its job."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

Log in or register to our website using your e-mail address and password.Hover the mouse pointer on the SUPPORT tab at the top.Click on Code Downloads & Errata.Enter the name of the book in the Search box.Select the book for which you're looking to download the code files.Choose from the drop-down menu where you purchased this book from.Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR / 7-Zip for WindowsZipeg / iZip / UnRarX for Mac7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Penetration-Testing-with-Raspberry-Pi-Second-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/PenetrationTestingwithRaspberryPi_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.

Chapter 1. Choosing a Pen Test Platform

In this chapter, we'll take a look at the hardware and software options available to us to build a low cost, small footprint, yet powerful penetration testing platform. We will go into some of the considerations we weighed, as well as why we chose the Raspberry Pi 3 as our hardware platform and the Kali Linux as the software distribution to build our penetration testing platform.

We will go through the steps of getting the hardware setup and the software installed so that we'll have a fully functional Raspberry Pi 3 with Kali Linux 2.0 running on it.

Most people get the operating system installed and immediately start playing around with the tools; however, we recommend not doing that. Many of the problems people experience can easily be corrected by following the setup and best practices covered in this chapter. These best practices include both pre-installation and post-installation modifications. We will go into some of the best practice tasks to be completed before we jump into the swing of things.

This chapter covers the following topics:

Hardware options and why the PiSoftware option and why KaliPurchasing a Raspberry PiAssembling a Raspberry PiInstalling Kali LinuxCombining Kali Linux and Raspberry PiCloning the Raspberry Pi SD cardAvoiding common problems

Hardware options and why the Pi

When researching for cheap and portable computing devices, there are many out there to choose from. This can make the process a little daunting if we don't know what we are looking for. Before we made our purchase, we started with a list of requirements that we felt were important. Some of the requirements we had when purchasing our option was the following:

Small footprintPowerfulWide community supportInexpensivePortable

There are very popular options out there such as, Arduino, Banana Pi, and even Intel with its newly announced Joule board. Each vendor out there is certainly a great option to use. The Intel platform is very powerful, but came in at too high a cost to justify. The Arduino certainly has a lot of community support and hardware options, but lacked some of the power we were looking for. Based on our requirements mentioned earlier, we decided to use a Raspberry Pi. It's the perfect small computer that offers a ton of flexibility, well-loved by the community with a lot of support, and definitely priced right.

Tip

This is the second edition of this book. The first edition focused on the Model B and all concepts are based on that limited performance. This edition, however, will be using a more current model of Raspberry Pi, Raspberry Pi 3, and therefore will provide more options.

Raspberry Pi has been around for some time. So if you do any research, we can see that there are multiple options out there. Here are the models to choose from:

Raspberry Pi 1 Model A+700 Mhz ARMv6 32-bit Single Core512 MB RAMRaspberry Pi 1 Model B+700 Mhz ARMv6 32-bit Single Core512 MB RAMRaspberry Pi 2 Model B900 Mhz ARMv7 32-bit Quad Core1 GB RAMRaspberry Pi 3 Model B2 Ghz ARMv8 64-bit Quad Core1 GB RAM

Let's not forget about the littlest Raspberry Pi out there, the Raspberry Pi Zero. This is a very inexpensive computer, typically available for $5. The Zero was released shortly after the Raspberry Pi 2 Model B. It is great for a lot of different projects we may want to build, offering a single-core 1 GHz processor and 512 MB SDRAM, and a cheaper alternative than the Pi 2 or Pi 3 models.

We should keep in mind that the Raspberry Pi Zero is a low-powered device compared to the Pi 3, so our mileage may vary. It's definitely not a direct replacement for the Pi 3 model, especially if we're looking for more hardware resources for our project.

As the models advanced, so did the hardware. The Pi 1 and Pi 2 models are great units, and they are still perfect for embedded projects. But due to the hardware enhancements and the power of the Raspberry Pi 3, Model B was our choice for this project. We wanted to get as much power in this little form factor as possible. The more power we have at our disposal, the better we should expect the pen-testing tools will perform.

Some of the key advantages the Raspberry Pi 3 has over the Raspberry Pi 2 are as follows:

Bluetooth 4.1 SupportBluetooth Low Energy (BLE)2 GHZ Quad core ARM processor802.11n wireless support

These new additions can definitely help us in our quest to create the perfect portable pen-testing platform, but as we'll see a little later, some of these features are still not quite ready for prime time.

So with all these options to choose from, we selected the Raspberry Pi 3. The power was there with the Quad cores running at 1.2 GHz as well as SDRAM. But that wasn't just it, the Raspberry Pi 3 also offered the flexibility to use new pen-testing tools with the built-in wireless, as well as Bluetooth. We were very excited to see these new options compared with the past versions.

Software option and why Kali

One of the first things we notice about the operating systems we can run on Raspberry Pi is that the list is pretty extensive. There is a lot of support for the hardware. That is yet another reason why we chose the Raspberry Pi hardware versus the other platforms that are available. For the penetration testing software, we chose to use Kali Linux (https://www.kali.org) for our Pi pen-testing box. Kali Linux comes with a ton of security tools already installed, and it is the successor to BackTrack, a well-respected, security-oriented Linux distribution we've used in the past. The Raspberry Pi custom images for Kali Linux are maintained by Offensive Security (https://www.offensive-security.com/).

Kali Linux is not the only great distro (or distribution) the specific blend of Linux operating system and applications) out there. Other great pen-testing distros are available for penetration testing. These other distros include PwnPi, Raspberry Pwn, and PwnBerry Pi. We will talk about these distros a little later in the book, specifically in Chapter 6, Finishing the Attack - Report and Withdraw. But for now, we are going to focus on Kali Linux as our distro of choice because of its huge community and support for most projects we targeted to include in this book.

Tip

If just looking for the supported distros for the Raspberry Pi, you can check out the Raspberry Pi website for downloads (https://www.raspberrypi.org/downloads/). The New Out Of Box Software (NOOBS) is a great option if you are unsure and is the recommended default.

Purchasing a Raspberry Pi

Purchasing a Raspberry Pi can be a daunting task. There are lots of kits on the Internet to choose from, as well as a ton of accessories available. We went to the CanaKit website (http://www.canakit.com) to look over some of the options. For beginners to the Raspberry Pi, we definitely suggest getting one of many available kits rather than piecing together the platform. Most, such as the CanaKit we selected, come with a lot of the things we will need right away, and will save us some money by buying the bundle versus purchasing the individual components a la carte.

The two main CanaKit offerings for Raspberry Pi 3 are the Ultimate Starter Kit and the Complete Starter Kit. The Ultimate Starter Kit comes with quite a few more accessories than the Complete Starter Kit. These additions include breadboards, a ribbon cable, a General-purpose input/output (GPIO) to Breadboard interface card, just to name a few. The price is only $15.00 more for all the additional stuff, so we went with the Ultimate Starter Kit because we not only found it to be the best deal overall, but also were not sure what future projects we may need the additional hardware for. We ordered ours through Amazon for about $89. Shop around, there are other sites out there as well to order from, and if we were in education, there are sites that provide these kits at significant discounts.

The following image is from CanaKits of the Complete Starter Kit, which is a good option if we were looking for all the major components needed in this book at the lowest price:

As for the Ultimate Starter Kit, the following image from CanaKits shows just how much more is included. This is one of the kits we purchased, just so we had more project options in the future:

Assembling a Raspberry Pi

Putting together Raspberry Pi 3 for basic operation is a pretty straightforward process. There are a few items that need to be assembled before the initial use. Depending on package we get, we may have some additional parts that can be put together. The first thing we did was installed the heat sinks onto both the Broadcom chip, as well as the LAN chip:

Next, we put the board in the case for protection, since we don't want anything to happen to our Raspberry Pi. There are different case options, and depending on the kit we get, we may get a different color or type. For example, there may be a need to hide our Pi from others. So stealth is sometimes a need or requirement, and the Pi can be hidden in objects or placed in a plain white case to look like it belongs to something else, such as a power adapter. In situations such as this, we may want to consider using a USB power supply to power our Raspberry Pi so as not to draw attention to the power cable running from the hidden Pi to the wall. This is ideal for a true plant scenario. Based on our tests, powering our Pi with the USB power stick gives us about 1 week or so, but our mileage will vary depending on the size of the power stick, as well as how heavily we consume the resources of the Pi over that time period.

Tip

Some people choose not to use the heat sinks or want to know if they are needed. We would always use the heat sink, especially if the Raspberry Pi is in a case and/or you plan on overclocking it (more on that topic in Chapter 2, Preparing for Battle). The chips tend to get a little hotter than the previous generations, and the last thing you would want to do is to overheat your Raspberry Pi.

After that, the Raspberry Pi 3 was fully assembled, we merely hooked up our monitor via the High-Definition Multimedia Interface (HDMI) interface using the cable provided,which is plugged in our USB mouse and keyboard, and start preparing for the SD card for the operating system.

Installing Kali Linux

The first step in installing Kali Linux onto our Raspberry Pi 3 is to prep the microSD card. For Kali Linux, we need to have at least 8 GB of capacity. For best performance, we'll try to make sure that the microSD card is a class 10. We want to make sure that with all of that new power and speed from the Quad core CPU, we won't get slowed down by a slow microSD card. It also helps to ensure that any separately purchased SD cards we may be considering are compatible or suitable, as some SD card brands and product lines work better than others. A great resource for checking this is the eLinux website (http://elinux.org/RPi_SD_cards).

Tip

Be sure to check out the SD Associations website to get a better understanding of the class speeds of the SD cards and where to locate them. This holds true for all types of SD cards, including the microSD cards, which are used on Raspberry Pi 3.

The SD card that comes with our Raspberry Pi may have software on it already. Ours came with NOOBS on it, which is handy if we are not sure what distro we are looking for, as we can choose from several options in the menu within NOOBS. Because we knew we wanted Kali Linux on our Raspberry Pi, we formatted the microSD card to start fresh and installed our own operating system on it. It is always a good idea to copy the existing content of the microSD card to another place before blowing it away. This way, we have the initial version of NOOBS in case we need to use that in the future. With the Ultimate Starter Kit, we received a USB-based microSD adapter. This is a very handy adapter, as most computers do not have a microSD card slot on them, including Apple devices. We plugged in our 32 GB microSD card into the adapter and then into our computer; then, we were ready to rock.

The following image shows the USB-based microSD adapter that we used in our lab:

Getting the right image of Kali is important for proper operation. When we browse https://www.kali.org/, we can find all the options available for Kali Linux. Since we are using an ARM processor on the Raspberry Pi, we will need to install the Raspberry Pi-specific image. The link will redirect us to the Offensive Security site (https://www.offensive-security.com/kali-linux-arm-images/) for a custom Kali image. We should note that there are lots of different ARM options depending on the hardware platform we are using. Since we are using Raspberry Pi 3, we will choose the version that works with that platform. We'll make sure that we note where our image gets downloaded to, so we don't have to go searching later. The ARM image is specifically designed for the Raspberry Pi hardware versus the full-blown image. Again, let's verify that we download the correct image.

Tip

It's a best practice to compare the SHA1 sum of your downloaded file to the SHA1 sum posted on the website. This way you can make sure that your image hasn't tampered with prior to installation.

Now that we have the image downloaded and ready to install, we need to write it to the microSD card. How we do this will depend on the operating system that we are using. For Windows, we can use the Win32DiskImager. This utility is available at the following URL:

https://sourceforge.net/projects/win32diskimager/

Once the utility is downloaded and opened, we are ready to proceed with imaging the SD card. We will first need to unzip the Kali image. We can use a program such as 7-Zip to unzip the image. When we unzip the file, we will be left with a folder, where we will find the .img file. We then need to select the image file in the Win32DiskImager utility, as well as the correct drive letter for the microSD card we want the image to go on. Let's click on Write, and let it do its job. This process can take some time, so be patient. When it's complete, press the Exit button.

The following screenshot is of the Win32DiskImager utility. It's a great little utility that is very easy to use:

If we are using a Mac or Linux machine, we can use the built-in dd utility to do the writing of the image.

The process on the Mac is as follows: