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
$19.99 per month
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8 (20 Ratings)
Paperback Oct 2017 376 pages 1st Edition
eBook
$27.98 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Himanshu Sharma
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8 (20 Ratings)
Paperback Oct 2017 376 pages 1st Edition
eBook
$27.98 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$27.98 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.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 this chapter, we will cover the following recipes:

  • Getting a list of subdomains
  • Using Shodan for fun and profit
  • Shodan Honeyscore
  • Shodan plugins
  • Using Nmap to find open ports
  • Bypassing firewalls with Nmap
  • Searching for open directories
  • Performing deep magic with DMitry
  • Hunting for SSL flaws
  • Exploring connections with intrace
  • Digging deep with theharvester
  • Finding technology behind web apps
  • Scanning IPs with masscan
  • Sniffing around with Kismet
  • Testing routers with firewalk

Introduction

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

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

Getting a list of subdomains

We don't always we have a situation where a client has defined a full detailed scope of what needs to be pentested. So we will use the following mentioned recipes to gather as much information as we can to perform a pentest.

Fierce

We start with jumping into Kali's Terminal and using the first and most widely used tool fierce.

How to do it...

The following steps demonstrate the use of fierce:

  1. To launch fierce, we type fierce -h to see the help menu:
  1. To perform a subdomain scan we use the following command:
        fierce -dns...

Using Shodan for fun and profit

Shodan is the world's first search engine to search for devices connected to 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 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 built in the Python. It helps us figure out whether an IP address we have is a honeypot or a real system.

How to do it...

The following steps demonstrate the use of Shodan Honeyscore:

  1. To use Shodan Honeyscore we visit https://honeyscore.shodan.io/:
  1. Enter the IP address we want to check, and that's it!

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...

We download and install the plugin from https://www.shodan.io/. Browse any website and we will see that by clicking on the plugin we can see the open ports:

See also

  • The Dnscan recipe from Chapter 1, Kali – An Introduction
  • The Digging deep with theharvester recipe

Using Nmap to find open ports

Network Mapper (Nmap) is a security scanner written by Gordon Lyon. It is used to find hosts and services in a network. It first came out in September 1997. Nmap has various features as well as scripts to perform various tests such as finding the OS, service version, brute force default logins, and so on.

Some of the most common types of scan are:

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

How to do it...

The following is the recipe for using Nmap:

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

The following screenshot shows the output of the preceding command:

  1. To perform a basic...

Introduction


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

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

Getting a list of subdomains


We don't always we have a situation where a client has defined a full detailed scope of what needs to be pentested. So we will use the following mentioned recipes to gather as much information as we can to perform a pentest.

Fierce

We start with jumping into Kali's Terminal and using the first and most widely used tool fierce.

How to do it...

The following steps demonstrate the use of fierce:

  1. To launch fierce, we type fierce -h to see the help menu:
  1. To perform a subdomain scan we use the following command:
        fierce -dns host.com -threads 10

The following screenshot shows the output of the preceding command:

DNSdumpster

This is a free project by Hacker Target to look up subdomains. It relies on https://scans.io/ for its results. It can also be used to get the subdomains of a website. We should always prefer to use more than one tool for subdomain enumeration as we may get something from other tools that the first one failed to pick.

How to do it...

It is pretty simple...

Using Shodan for fun and profit


Shodan is the world's first search engine to search for devices connected to 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 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...

To learn about Shodan, follow the given steps:

  1. Open your browser and visit https://www.shodan.io:
  1. We begin by performing a simple search for the FTP services running. To do this we can use the following Shodan dorks: port:"21". The following screenshot shows the search results:
  1. This search can be made more specific by specifying a particular country/organization: port:"21" country:"IN". The following screenshot shows the search results:
  1. We can now see all the FTP servers running in India; we can also see the servers that allow anonymous...

Shodan Honeyscore


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

How to do it...

The following steps demonstrate the use of Shodan Honeyscore:

  1. To use Shodan Honeyscore we visit https://honeyscore.shodan.io/:
  1. Enter the IP address we want to check, and that's it!

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...

We download and install the plugin from https://www.shodan.io/. Browse any website and we will see that by clicking on the plugin we can see the open ports:

See also

  • The Dnscan recipe from Chapter 1, Kali – An Introduction
  • The Digging deep with theharvester recipe

Using Nmap to find open ports


Network Mapper (Nmap) is a security scanner written by Gordon Lyon. It is used to find hosts and services in a network. It first came out in September 1997. Nmap has various features as well as scripts to perform various tests such as finding the OS, service version, brute force default logins, and so on.

Some of the most common types of scan are:

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

How to do it...

The following is the recipe for using Nmap:

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

The following screenshot shows the output of the preceding command:

  1. To perform a basic scan we use the following command:
        nmap -sV -Pn x.x.x.x

The following screenshot shows the output of the preceding command:

  1. -Pn implies that we do not check whether the host is up or not by performing a ping request first. The -sV parameter is to list all the running services on...

Bypassing firewalls with Nmap


Most of the time during a pentest, we will come across systems protected by firewalls or Intrusion Detection Systems (IDS). The Nmap provides different ways to bypass these IDS/firewalls to perform port scans on a network. In this recipe, we will learn some of the ways we can bypass firewalls.

TCP ACK scan

The ACK scan (-sA) sends acknowledgment packets instead of SYN packets, and the firewall does not create logs of ACK packets as it will treat ACK packets as responses to SYN packets. It is mostly used to map the type of firewall being used.

How to do it...

The ACK scan was made to show unfiltered and filtered ports instead of open ones.

The command for ACK scan is:

nmap -sA x.x.x.x

Let's look at the comparison of how a normal scan differs from an ACK scan:

 

Here we see the difference between a normal scan and an ACK scan:

How it works...

The scan results of filtered and unfiltered ports depends on whether a firewall being used is stateful or stateless. A stateful firewall...

Searching for open directories


In the previous recipe, we discussed how to find open ports on a network IP or domain name. We often see developers running web servers on different ports. Sometimes developers may also leave directories misconfigured that may contain juicy information for us. We have already covered dirsearch in the previous chapter; here we will look at alternatives.

The dirb tool

The dirb tool is a well-known tool that can be used to brute force open directories. Although it is generally slow and does not support multi-threading, it is still a great way to find directories/subdirectories that may have been left open due to a misconfiguration.

How to do it...

Type the following command to fire up the tool:

dirb https://domain.com

The following screenshot shows the output of the preceding command:

There's more...

There are other options in dirb, as well, that come in handy:

  • -a: to specify a user agent
  • -c: to specify a cookie
  • -H: to enter a custom header
  • -X: to specify the file extension...

Performing deep magic with DMitry


The Deepmagic Information Gathering Tool (DMitry) is a command-line tool open source application coded in C. It has the capability of gathering subdomains, email addresses, whois info, and so on, about a target.

How to do it...

To learn about DMitry, follow the given steps:

  1. We use a simple command:
dmitry -h

The following screenshot shows the output of the preceding command:

  1. Next, we try performing an email, whois, TCP port scan, and subdomain search by using the following:
dmitry -s -e -w -p domain.com

The following screenshot shows the output of the preceding command:

Hunting for SSL flaws


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

How to do it...

To learn about sslscan follow the given 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:

See also

  • The A tale of a bleeding heart recipe from Chapter 5, Network Exploitation on Current Exploitation

TLSSLed is also an alternative we can use in Kali to perform checks on SSL.

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 : 9781787121829
Vendor :
Linux Foundation
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 : Oct 17, 2017
Length: 376 pages
Edition : 1st
Language : English
ISBN-13 : 9781787121829
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 $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 152.97
Kali Linux Cookbook
$48.99
Kali Linux - An Ethical Hacker's Cookbook
$48.99
Mastering Kali Linux for Advanced Penetration Testing, Second Edition
$54.99
Total $ 152.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

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.