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

Arrow left icon
Profile Icon Himanshu Sharma
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (6 Ratings)
Paperback Mar 2019 472 pages 2nd Edition
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Himanshu Sharma
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (6 Ratings)
Paperback Mar 2019 472 pages 2nd Edition
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781789952308
Vendor :
Linux Foundation
Category :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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
€264.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.