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: Practical recipes that combine strategies, attacks, and tools for advanced penetration testing , Second Edition

eBook
£20.98 £29.99
Paperback
£36.99
Subscription
Free Trial
Renews at £16.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
Product feature icon AI Assistant (beta) to help accelerate your learning
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

Gathering Intel and Planning Attack Strategies

In the previous chapter, we learned about the basics of hunting subdomains. In this chapter, we will dive a little deeper and look at other tools that are available for gathering Intel on our target. We will start by using the infamous tools of Kali Linux.

Gathering information is a crucial stage of performing a penetration test, as every step we take after this will be an outcome of all the information we gather during this stage. For this reason, it is very important that we gather as much information as possible before jumping into the exploitation stage.

In this chapter, we will cover the following recipes:

  • Getting a list of subdomains
  • Using Shodan for fun and profit
  • Shodan Honeyscore
  • Shodan plugins
  • Censys
  • Using Nmap to find open ports
  • Bypassing firewalls with Nmap
  • Searching for open directories using GoBuster
  • Hunting for SSL...

Getting a list of subdomains

When performing a black-box test, the client may not give us all of the subdomains of their organization. In this recipe, we will cover one of the few techniques that can be used to get a list of the subdomains of an organization.

How to do it...

DNSdumpster: It is a free project by HackerTarget that lets us look up subdomains. It relies on https://scans.io/ for its results. It is pretty simple to use.

  1. We type the domain name we want and it will show us the results of all the subdomains it could find:

In the following screenshot, we can see the subdomains of the domain packtpub.com:

In the following recipe, we will look at Shodan, which is the most useful source for knowing about what devices...

Using Shodan for fun and profit

Shodan is the world's first search engine that was used to search for devices that are connected on the internet. It was launched in 2009 by John Matherly. Shodan can be used to look up webcams, databases, industrial systems, video games, and so on. Shodan mostly collects data on the most popular web services that are running, such as HTTP, HTTPS, MongoDB, FTP, and many more.

Getting ready

To use Shodan, we will need to create an account on Shodan.

How to do it...

Shodan Honeyscore

Shodan Honeyscore is another great project that was built in Python. It helps us figure out whether an IP address we have found is a honeypot or a real system.

How to do it...

  1. To use Shodan Honeyscore, visit https://honeyscore.shodan.io/, as shown:
  1. Then, enter the IP address you want to check, which in this case is 8.8.8.8:

That's it! Now, let's look at the plugins for Shodan.

Shodan plugins

To make our life even easier, Shodan has plugins for Chrome and Firefox that can be used to check open ports for websites we visit on the go!

How to do it...

  1. Download and install the plugin from https://www.shodan.io/.
  2. Browse to any website. You will find that by clicking on the plugin, you can see the open ports:

In the following recipe, we will discover, monitor, and analyze devices with Censys.

Censys

Censys was created in 2017 by the developers of ZMAP. It helps users to discover, monitor, and analyze publicly available devices. Censys regularly explores every IP and popular domain names using ZMAP scans and collects this data to make it available through APIs or web interfaces. In this recipe, we will look at some of the ways to use Censys for recon.

How to do it...

  1. Visit https://censys.io/ in your browser, as shown in the following screenshot:
  1. We must be a logged-in user to perform detailed searches, which we will cover later in this recipe.
  1. If we want to look for a particular IP, we can simply paste the IP in the search bar. As we can see in the following screenshot, it will give us basic information about...

Using Nmap to find open ports

Nmap or Network Mapper is a security scanner that was written by Gordon Lyon in September 1997. It is used to find hosts and services in a network. Nmap has various features and scripts that are designed to perform various tests, such as finding the OS, service version, and brute-force default logins.

The following are some of the most common types of scan:

  • TCP connect() scan
  • SYN stealth scan
  • UDP scan
  • Ping scan
  • Idle scan

How to do it...

Let's perform the following steps:

  1. Nmap is already installed in Kali Linux. We can type the following command to start it and see all the options that are available:
       nmap -h

The following screenshot shows the output of the preceding command:

  1. To...

Bypassing firewalls with Nmap

Most of the time, during a pentest, we will come across systems that are protected by firewalls or intrusion detection systems (IDS). Nmap provides different ways of bypassing these IDS firewalls to perform a port scan on a network.

In this recipe, we will learn about some of the ways of bypassing firewalls.

How to do it...

Let's learn how to use the ACK, TCP Window, and Idle scans.

TCP ACK scan (-sA)

The ACK scan is used to show unfiltered and filtered ports instead of open and closed ports:

  1. The command for an ACK scan is as follows...

Searching for open directories using GoBuster

In the previous recipe, we discussed how to find open ports on a network IP or domain name. Once we have open ports, we often see ports running web servers on different ports. Sometimes, developers leave open directories misconfigured, which may contain juicy information for us. Here, we will look at the GoBuster. It is a tool that was built in the Go language, which can be used for brute forcing directories as well as brute forcing subdomains.

How to do it...

Since GoBuster is built on Go, we first need to install Go on Kali:

  1. Do this by using the following command:
apt install golang
  1. First, we clone the Git repository from the following URL: https://github.com/OJ/gobuster....

Hunting for SSL flaws

Most web applications today use SSL to communicate with the server. SSLscan is a great tool to check SSL for flaws or misconfigurations.

In this recipe, we will learn how to use SSLScan to perform an analysis of SSL configured on the website.

How to do it...

Let's perform the following steps:

  1. We will look at the help manual to see the various options the tool has:
sslscan -h

The following screenshot shows the output of the preceding command:

  1. To run the tool against a host, we type the following:
sslscan host.com:port

The following screenshot shows the output of the preceding command and we can see various types of information on the SSL protocol implemented on google.com:

As we can see from...

Automating brute force with BruteSpray

BruteSpray is another open source tool which is built on Python. It takes the input from an Nmap scan and automatically brute forces the services running with default credentials using Medusa.

How to do it...

Let's perform the following steps:

  1. Run the following command to install brutespray on Kali:
apt install brutespray 

The following screenshot shows the output of the preceding command:

  1. Once it is installed, we can run the tool with the -h flag to view the list of all features.
  2. To run a default brute force on all of the services that were discovered by a previously run Nmap scan, we can use the following command:
brutespray --file scan.xml --threads 5

The following screenshot...

Digging deep with TheHarvester

TheHarvester is a great tool for penetration testing as it helps us find a lot of information about a company. It can be used to find email accounts, subdomains, and so on. In this recipe, we will learn how to use it to discover data.

How to do it...

  1. The command to the TheHarvester is pretty simple:
theharvester -d domain_name -l 20 -b all  

We can see in the following screenshot that the tool has launched and it will give us the results of anything it will find once finished:

How it works...

In the preceding recipe, -d is for the domain...

Finding technology behind webapps using WhatWeb

There is no point starting a pentest against a web application without knowing what the actual technology is behind it. For example, it would be absolutely useless to run dirs3arch to look for files with the extension PHP when the technology is actually Asp. So, in this recipe, we will learn how to use a simple tool, WhatWeb, to reveal the technology behind a webapp. It comes by default in Kali.

It can also be installed manually from the following URL: https://github.com/urbanadventurer/WhatWeb.

How to do it...

  1. The WhatWeb tool can be launched by using the following command:
whatweb

The following screenshot shows the output of the preceding command:

  1. The domain name can be...

Scanning IPs with masscan

Masscan is an amazing tool. It is the fastest port scan tool available, and it has been claimed that it can scan the entire internet when it transmits at the speed of 10 million packets per second.

It is similar to Nmap, but it does not support and default to the port scan – all ports must be specified using -p.

In this recipe, we will learn about the usage of Masscan.

How to do it...

  1. Masscan is simple to use. We can begin a scan of a network by using the following command:
masscan 192.168.1.0/24 -p 80,443,23  

We can also specify the packet rate by using -max-rate. By default, the rate is 100 packets per second.

Finding origin servers with CloudBunny

CloudBunny is a tool that uses search engines such as Censys, Shodan, and Zoomeye to find the origin IP of the server. It is typically used when a company only uses a Web Application Firewall (WAF) for its main domain and leaves the subdomains unprotected. CloudBunny uses the same concept to find origin IPs of the domains. In this recipe, we will look at the usage of CloudBunny to find misconfigured Cloudflare domains.

How to do it...

  1. Download/clone the repository from GitHub: https://github.com/Warflop/CloudBunny:
  1. Next, install the Python dependencies by using the pip install -r requirements.txt command.
  2. Since the tool is dependent on Shodan, Censys, and Zoomeye, we need to provide...

Sniffing around with Kismet

Kismet is a layer two wireless network detector. It comes in handy because while performing a pentest in a corporate environment, we may need to look for wireless networks as well. Kismet can sniff 802.11a/b/g/n traffic. It works with any wireless card that supports raw monitoring mode.

In this recipe, we will learn how to use Kismet to monitor Wi-Fi networks.

How to do it...

  1. Use the following command to launch Kismet:
kismet 

The following screenshot shows the output of the preceding command:

  1. Once the GUI is up, it will ask us to start the server. Choose Yes.
  2. Next, we need to specify a source interface. In our case, it is wlan0, so we type that in. Make sure that the interface is in monitor...

Testing routers with Firewalk

Firewalk is a network security reconnaissance tool that helps us figure out whether our routers are actually doing the job they are supposed to do. Firewalk attempts to find which protocols a router or firewall will allow and which it will block.

This tool is incredibly useful during pentesting, and can help you verify and validate firewall policies in a corporate environment. In this recipe, we will learn about using Firewalk.

How to do it...

  1. If firewalk is not installed, we can install it by typing the following:
apt install firewalk

The following screenshot shows the output of the preceding command:

  1. We can use the following command to run firewalk:
firewalk -S 1-23 -i eth0 192.168.1.1...
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

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

Description

Many organizations have been affected by recent cyber events. At the current rate of hacking, it has become more important than ever 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 2018.4 / 2019), in addition to covering the core functionalities. The book will get you off to a strong start by introducing you to the installation and configuration of Kali Linux, which will help you to perform your tests. You will also learn how to plan attack strategies and perform web application exploitation using tools such as Burp and JexBoss. As you progress, you will get to grips with performing network exploitation using Metasploit, Sparta, and Wireshark. The book will also help you delve into the technique of carrying out wireless and password attacks using tools such as Patator, John the Ripper, and airoscript-ng. Later chapters will draw focus to the wide range of tools that help in forensics investigations and incident response mechanisms. As you wrap up the concluding chapters, you will learn to create an optimum quality pentest report. By the end of this book, you will be equipped with the knowledge you need to conduct advanced penetration testing, thanks to the book’s crisp and task-oriented recipes.

Who is this book for?

If you are an IT security professional, pentester, or security analyst who wants to conduct advanced penetration testing techniques, then this book is for you. Basic knowledge of Kali Linux is assumed.

What you will learn

  • Learn how to install, set up and customize Kali for pentesting on multiple platforms
  • Pentest routers and embedded devices
  • Get insights into fiddling around with software-defined radio
  • Pwn and escalate through a corporate network
  • Write good quality security reports
  • Explore digital forensics and memory analysis with Kali Linux

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 29, 2019
Length: 472 pages
Edition : 2nd
Language : English
ISBN-13 : 9781789953701
Vendor :
Linux Foundation
Category :
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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Mar 29, 2019
Length: 472 pages
Edition : 2nd
Language : English
ISBN-13 : 9781789953701
Vendor :
Linux Foundation
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.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
£169.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
£234.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 £ 110.97
Kali Linux 2018: Assuring Security by Penetration Testing
£36.99
Hands-On AWS Penetration Testing with Kali Linux
£36.99
Kali Linux - An Ethical Hacker's Cookbook
£36.99
Total £ 110.97 Stars icon
Banner background image

Table of Contents

14 Chapters
Kali - An Introduction Chevron down icon Chevron up icon
Gathering Intel and Planning Attack Strategies Chevron down icon Chevron up icon
Vulnerability Assessment - Poking for Holes Chevron down icon Chevron up icon
Web App Exploitation - Beyond OWASP Top 10 Chevron down icon Chevron up icon
Network 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
Elementary, My Dear Watson - Digital Forensics 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
Other Books You May Enjoy 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.2
(6 Ratings)
5 star 66.7%
4 star 16.7%
3 star 0%
2 star 0%
1 star 16.7%
Filter icon Filter
Top Reviews

Filter reviews by




Yehia Serrieh May 27, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
if you need very detailed book so you can master kali with all tools included plus nethunter then this is your book, do you want to master pentest and writing very organized report then this is your book it worth every cent you will pay for it
Amazon Verified review Amazon
Antonio Garcia Dec 07, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Sehr gut!
Amazon Verified review Amazon
Yoonus Ibrahim Aug 28, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
awesome
Amazon Verified review Amazon
IndianWeeboo Nov 09, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book but the screenshots are not so clear.
Amazon Verified review Amazon
Jonathan B. Aug 15, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Excellent introduction to Kali. Based on the description I would have thought there was more detail and content than there was though.The font was large which makes it easy to read but also a lot less content than I expected there to be. I’m a slow reader and was reading 120 pages a day.Otherwise it was great, learnt quite a bit even though I’ve been using Kali for a while. I will however be looking for more detailed books.
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.