Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Kali Linux - An Ethical Hacker's Cookbook
Kali Linux - An Ethical Hacker's Cookbook

Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions

Arrow left icon
Profile Icon Himanshu Sharma
Arrow right icon
Mex$179.99 Mex$803.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8 (20 Ratings)
eBook Oct 2017 376 pages 1st Edition
eBook
Mex$179.99 Mex$803.99
Paperback
Mex$1004.99
Subscription
Free Trial
Arrow left icon
Profile Icon Himanshu Sharma
Arrow right icon
Mex$179.99 Mex$803.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8 (20 Ratings)
eBook Oct 2017 376 pages 1st Edition
eBook
Mex$179.99 Mex$803.99
Paperback
Mex$1004.99
Subscription
Free Trial
eBook
Mex$179.99 Mex$803.99
Paperback
Mex$1004.99
Subscription
Free Trial

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

Kali Linux - An Ethical Hacker's Cookbook

Kali – An Introduction

In this chapter, we will cover the following recipes:

  • Configuring Kali Linux
  • Configuring the Xfce environment
  • Configuring the Mate environment
  • Configuring the LXDE environment
  • Configuring the e17 environment
  • Configuring the KDE environment
  • Prepping up with custom tools
  • Pentesting VPN's ike-scan
  • Setting up proxychains
  • Going on a hunt with Routerhunter

Introduction

Kali was first introduced in 2012 with a completely new architecture. This Debian-based distro was released with over 300 tools specialized for penetration testing and digital forensics. It is maintained and funded by Offensive Security Ltd with core developers being Mati Aharoni, Devon Kearns, and Raphael Hertzog.

Kali 2.0 came into the picture in 2016 with tons of new updates and new desktop environments such as KDE, Mate, LXDE, e17, and Xfce builds.

While Kali is already pre-equipped with hundreds of amazing tools and utilities to help penetration testers around the globe to perform their job efficiently, in this chapter, we will primarily cover some custom tweaks that can be used to have an even better pentesting experience for the users.

Configuring Kali Linux

We will use the official Kali Linux ISO provided by Offensive Security to install and configure different desktop environments such as Mate, e17, Xfce, LXDE, and KDE desktops.

Getting ready

How to do it...

You can configure Kali with the help of the given steps:

  1. Double-click on the VirtualBox image, it should open with VirtualBox:
  1. Click Import:
  1. Start the machine and enter the password as toor:
  1. Now, Kali is started and by default is configured with the GNOME desktop environment:

How it works...

With the pre-built image you don't need to worry about the installation process. You can consider it as a ready-to-go solution. Simply click on run and the virtual machine will boot up Linux just like a normal machine.

Configuring the Xfce environment

Xfce is a free, fast, and lightweight desktop environment for Unix and Unix-like platforms. It was started by Olivier Fourdan in 1996. The name Xfce originally stood for XForms Common Environment, but since that time Xfce has been rewritten twice and no longer uses the XForms toolkit.

How to do it...

To configure the Xfce environment follow the given steps:

  1. We start by using the following command to install Xfce along with all plugins and goodies:
        apt-get install kali-defaults kali-root desktop-base xfce4
xfce4-places-plugin xfce4-goodies

The following screenshot shows the preceding command:

  1. Type Y when it asks for confirmation on additional space requirements.
  2. Select Ok on the dialogue box that appears.
  1. We select lightdm as our default desktop manager and press the Enter key.
  2. When the installation is complete we open a Terminal window and type the following command:
        update-alternatives --config x-session-manager

The following screenshot shows the output of the preceding command:

  1. Choose the option xfce4-session (in our case 3) and press the  Enter key.
  1. Log out and log in again or you can restart the machine and we will see the Xfce environment:

Configuring the Mate environment

The Mate desktop environment was built in continuation of GNOME 2. It was first released in 2011.

How to do it...

To configure the Mate environment follow the given steps:

  1. We start by using the following command to install the Mate environment:
        apt-get install desktop-base mate-desktop-environment

The following screenshot shows the preceding command:

  1. Type Y when it asks for confirmation on additional space requirements.
  2. When installation is complete we will use the following command to set Mate as our default environment:
        update-alternatives --config x-session-manager
  1. Choose the option mate-session (in our case 2) and press the Enter key:
  1. Log out and log in again or restart and we will see the Mate environment:

Configuring the LXDE environment

LXDE is a free open source environment written in C using GTK+ toolkit for Unix and other POSIX platforms. Lightweight X11 Desktop Environment (LXDE) is the default environment for many operating systems such as Knoppix, Raspbian, Lubuntu, and so on.

How to do it...

To configure the LXDE environment follow the given steps:

  1. We start by using the following command to install LXDE:
        apt-get install lxde-core lxde
  1. Type Y when it asks for confirmation on additional space requirements.
  2. When the installation is complete we open a Terminal window and type the following command:
        update-alternatives --config x-session-manager

The following screenshot shows the output for the preceding command:

  1. Choose the option lxsession (in our case 4) and press Enter.
  1. Log out and log in again and we will see the LXDE environment:

Configuring the e17 environment

Enlightenment, or otherwise known as E, is a window manager for the X Windows system. It was first released in 1997. It has lots of features such as engage, virtual desktop, tiling, and so on.

How to do it...

Due to compatibility issues and dependencies hassle it is better to set up the Kali environment as a different machine. This ISO image (Kali 64-bit e17) is already available on the official website of Kali Linux and can be downloaded from the following URL:

https://www.kali.org/downloads/.

Configuring the KDE environment

KDE is an international community for free software. The plasma desktop is one of the most popular projects of KDE; it comes as a default desktop environment for a lot of Linux distributions. It was founded in 1996 by Matthias Ettrich.

How to do it...

To configure the KDE environment follow the given steps:

  1. We use the following command to install KDE:
        apt-get install kali-defaults kali-root-login desktop-base
kde-plasma-desktop

The following screenshot shows the output for the preceding command:

  1. Type Y when it asks for confirmation on additional space requirements.
  2. Click OK on both the windows that pop up.
  3. When the installation is complete we open a Terminal window and type the following command:
        update-alternatives --config x-session-manager

The following screenshot shows the output for the preceding command:

  1. Choose the option KDE session (in our case 2) and press Enter.
  2. Log out and log in again and we will see the KDE environment:
Kali already has provided prebuilt images of different desktop environments. These can be downloaded from here: https://www.kali.org/downloads/.

Prepping up with custom tools

These tools you will install are open source available on GitHub. They are much faster and contain collections of different tweaks that people have included over a period of time during their own pentesting experience.

Getting ready

Here is a list of some tools that you will need before we dive deeper into penetration testing. Not to worry, you will be learning their usage with some real-life examples in the next few chapters. However, if you still wish to learn basics in an early stage it can simply be done with simple commands:

  • toolname -help
  • toolname -h

How to do it...

Some of the tools are listed in the following sections.

Dnscan

Dnscan is a Python tool that uses a wordlist to resolve valid subdomains. To learn about Dnscan follow the given steps:

  1. We will use a simple command to clone the git repository:
        git clone https://github.com/rbsec/dnscan.git

The following screenshot shows the preceding command:

  1. You can also download and save it from https://github.com/rbsec/dnscan.
  2. Next we browse into the directory where we downloaded Dnscan.
  1. Run Dnscan by using the following command:
        ./dnscan.py -h

The following screenshot shows the output for the preceding command:

Subbrute

Next we will install subbrute. It is amazingly fast and provides an extra layer of anonymity as it uses public resolvers to brute force the subdomains:

  1. The command here is again simple:
        git clone https://github.com/TheRook/subbrute.git

The following screenshot shows the preceding command:

  1. Or you can download and save it from https://github.com/TheRook/subbrute.
  2. Once the installation is complete we will need a wordlist for it to run for which we can download dnspop's list. This list can be used in the previous recipe too: https://github.com/bitquark/dnspop/tree/master/results.
  3. Once both are set up we browse into the subbrute's directory and run it using the following command:
        ./subbrute.py
  1. To run it against a domain with our wordlist we use the following command:
        ./subbrute.py -s /path/to/wordlist hostname.com

Dirsearch

Our next tool in the line is dirsearch. As the name suggests it is a simple command-line tool that can be used to brute force the directories. It is much faster than the traditional DIRB:

  1. The command to install is:
        git clone https://github.com/maurosoria/dirsearch.git
  1. Or you can download and save it from https://github.com/maurosoria/dirsearch. The following screenshot shows the preceding command:
  1. Once the cloning is complete browse to the directory and run the tool by using the following:
        ./dirsearch.py -u hostname.com -e aspx,php

The following screenshot shows the output for the preceding command:

Pentesting VPN's ike-scan

Often during a pentest we may encounter VPN endpoints. However, finding vulnerabilities in those endpoints and exploiting them is not a well known method. VPN endpoints use Internet Key Exchange (IKE) protocol to set up a security association between multiple clients to establish a VPN tunnel.

IKE has two phases, phase 1 is responsible for setting up and establishing secure authenticated communication channel, and phase 2 encrypts and transports data.

Our focus of interest here would be phase 1; it uses two methods of exchanging keys:

  • Main mode
  • Aggressive mode

We will hunt for aggressive mode enabled VPN endpoints using PSK authentication.

Getting ready

For this recipe we will use the tools ike-scan and ikeprobe. First we install ike-scan by cloning the git repository:

git clone https://github.com/royhills/ike-scan.git

Or you can use the following URL to download it from https://github.com/royhills/ike-scan.

How to do it...

To configure ike-scan follow the given steps:

  1. Browse to the directory where ike-scan is installed.
  2. Install autoconf by running the following command:
        apt-get install autoconf
  1. Run autoreconf --install to generate a .configure file.
  2. Run ./configure.
  3. Run make to build the project.
  4. Run make check to verify the building stage.
  5. Run make install to install ike-scan.
  6. To scan a host for an aggressive mode handshake, use the following commands:
        ike-scan x.x.x.x -M -A

The following screenshot shows the output for the preceding command:

  1. Sometimes we will see the response after providing a valid group name like (vpn):
        ike-scan x.x.x.x -M -A id=vpn

The following screenshot shows the example of the preceding command:

We can even brute force the groupnames using the following script:
https://github.com/SpiderLabs/groupenum.

The command:
./dt_group_enum.sh x.x.x.x groupnames.dic

Cracking the PSK

To learn how to crack the PSK follow the given steps:

  1. Adding a -P flag in the ike-scan command it will show a response with the captured hash.
  2. To save the hash we provide a filename along with the -P flag.
  3. Next we can use the psk-crack with the following command:
        psk-crack -b 5 /path/to/pskkey
  1. Where -b is brute force mode and length is 5.
  2. To use a dictionary based attack we use the following command:
        psk-crack -d /path/to/dictionary /path/to/pskkey

The following screenshot shows the output for the preceding command:

How it works...

In aggressive mode the authentication hash is transmitted as a response to the packet of the VPN client that tries to establish a connection Tunnel (IPSEC). This hash is not encrypted and hence it allows us to capture the hash and perform a brute force attack against it to recover our PSK.

This is not possible in main mode as it uses an encrypted hash along with a six way handshake, whereas aggressive mode uses only three way.

Setting up proxychains

Sometimes we need to remain untraceable while performing a pentest activity. Proxychains helps us by allowing us to use an intermediary system whose IP can be left in the logs of the system without the worry of it tracing back to us.

Proxychains is a tool that allows any application to follow connection via proxy such as SOCKS5, Tor, and so on.

How to do it...

Proxychains is already installed in Kali. However, we need a list of proxies into its configuration file that we want to use:

  1. To do that we open the config file of proxychains in a text editor with this command:
        leafpad /etc/proxychains.conf

The following screenshot shows the output for the preceding command:

We can add all the proxies we want in the preceding highlighted area and then save.

Proxychains also allows us to use dynamic chain or random chain while connecting to proxy servers.

  1. In the config file uncomment the dynamic_chain or random_chain:

Using proxychains with tor

To learn about tor follow the given steps:

  1. To use proxychains with tor we first need to install tor using the following command:
        apt-get install tor
  1. Once it is installed we run tor by typing tor in the Terminal.
  2. We then open another Terminal and type the following command to use an application via proxychains:
        proxychains toolname -arguments

The following screenshot shows the example of the preceding commands:

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • •Practical recipes to conduct effective penetration testing using the powerful Kali Linux
  • •Leverage tools like Metasploit, Wireshark, Nmap, and many more to detect vulnerabilities with ease
  • •Confidently perform networking and application attacks using task-oriented recipes

Description

With the current rate of hacking, it is very important to pentest your environment in order to ensure advanced-level security. This book is packed with practical recipes that will quickly get you started with Kali Linux (version 2016.2) according to your needs, and move on to core functionalities. This book will start with the installation and configuration of Kali Linux so that you can perform your tests. You will learn how to plan attack strategies and perform web application exploitation using tools such as Burp, and Jexboss. You will also learn how to perform network exploitation using Metasploit, Sparta, and Wireshark. Next, you will perform wireless and password attacks using tools such as Patator, John the Ripper, and airoscript-ng. Lastly, you will learn how to create an optimum quality pentest report! By the end of this book, you will know how to conduct advanced penetration testing thanks to the book’s crisp and task-oriented recipes.

Who is this book for?

This book is aimed at IT security professionals, pentesters, and security analysts who have basic knowledge of Kali Linux and want to conduct advanced penetration testing techniques.

What you will learn

  • • Installing, setting up and customizing Kali for pentesting on multiple platforms
  • • Pentesting routers and embedded devices
  • • Bug hunting 2017
  • • Pwning and escalating through corporate network
  • • Buffer over?ows 101
  • • Auditing wireless networks
  • • Fiddling around with software-defned radio
  • • Hacking on the run with NetHunter
  • • Writing good quality reports

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 17, 2017
Length: 376 pages
Edition : 1st
Language : English
ISBN-13 : 9781787120280
Vendor :
Linux Foundation
Tools :

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 : Oct 17, 2017
Length: 376 pages
Edition : 1st
Language : English
ISBN-13 : 9781787120280
Vendor :
Linux Foundation
Tools :

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 Mex$85 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 Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 3,138.97
Kali Linux Cookbook
Mex$1004.99
Kali Linux - An Ethical Hacker's Cookbook
Mex$1004.99
Mastering Kali Linux for Advanced Penetration Testing, Second Edition
Mex$1128.99
Total Mex$ 3,138.97 Stars icon
Banner background image

Table of Contents

12 Chapters
Kali – An Introduction Chevron down icon Chevron up icon
Gathering Intel and Planning Attack Strategies Chevron down icon Chevron up icon
Vulnerability Assessment Chevron down icon Chevron up icon
Web App Exploitation – Beyond OWASP Top 10 Chevron down icon Chevron up icon
Network Exploitation on Current Exploitation Chevron down icon Chevron up icon
Wireless Attacks – Getting Past Aircrack-ng Chevron down icon Chevron up icon
Password Attacks – The Fault in Their Stars Chevron down icon Chevron up icon
Have Shell Now What? Chevron down icon Chevron up icon
Buffer Overflows Chevron down icon Chevron up icon
Playing with Software-Defined Radios Chevron down icon Chevron up icon
Kali in Your Pocket – NetHunters and Raspberries Chevron down icon Chevron up icon
Writing Reports Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8
(20 Ratings)
5 star 65%
4 star 0%
3 star 10%
2 star 0%
1 star 25%
Filter icon Filter
Top Reviews

Filter reviews by




abhilasha gupta Jan 11, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
After so long i found a book that genuinely teaches me something!
Amazon Verified review Amazon
Anthony Feb 04, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Amazing book
Amazon Verified review Amazon
Ayan Saha May 25, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
its the best book available in india to learn kali Linux penetration testing in a practical manner , don't waste your time and money by funding money on courses which costs 1000$ , rather but this type of books you can great a plenty amount of knowledge from them
Amazon Verified review Amazon
Trip Nine May 25, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Kali Linux - An Ethical Hacker's Cookbook (Second Edition) is jam packed with techniques and exploits that are relevant for 2019 and it's packaged in an easy to read bundle.Sure you can find a lot of things on the internet for free that are covered in the book - but not all in one place. And time is money.Don't burn hours trying to compile exploits and tactics that make up a great Kali cookbook when there is one right here.Get it and then use it to as a library reference delivering value to your customers in information security.
Amazon Verified review Amazon
Yehia Serrieh May 27, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
comprehensive and very practical book it contains a skills, and experience you will never find on internet this book can teach you tips, tricks, and hints so you can master kali with all tools included
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.