Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Metasploit Penetration Testing Cookbook
Metasploit Penetration Testing Cookbook

Metasploit Penetration Testing Cookbook: Over 70 recipes to master the most widely used penetration testing framework with this book and ebook.

Arrow left icon
Profile Icon Abhinav Singh
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.9 (13 Ratings)
Paperback Jun 2012 268 pages 1st Edition
eBook
₱579.99 ₱2245.99
Paperback
₱2806.99
Subscription
Free Trial
Arrow left icon
Profile Icon Abhinav Singh
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.9 (13 Ratings)
Paperback Jun 2012 268 pages 1st Edition
eBook
₱579.99 ₱2245.99
Paperback
₱2806.99
Subscription
Free Trial
eBook
₱579.99 ₱2245.99
Paperback
₱2806.99
Subscription
Free Trial

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

Metasploit Penetration Testing Cookbook

Chapter 2. Information Gathering and Scanning

In this chapter, we will cover:

  • Passive information gathering 1.0 – the traditional way

  • Passive information gathering 2.0 – the next level

  • Port scanning – the Nmap way

  • Exploring auxiliary modules for scanning

  • Target service scanning with auxiliary modules

  • Vulnerability scanning with Nessus

  • Scanning with NeXpose

  • Sharing information with the Dradis framework

Introduction


Information gathering is the first basic step towards penetration testing. This step is carried out to find out as much information about the target machine as possible. The more information we have, the better will be our chances of exploiting the target. During the information gathering phase, our main focus is to collect facts about the target machine, such as the IP address, available services, open ports. This information plays a vital role in the process of penetration testing. There are basically three types of techniques used in information gathering.

  • Passive information gathering

  • Active information gathering

  • Social engineering

Let us take a quick look at these processes:

  • Passive information gathering: This technique is used to gain information about the target without having any physical connectivity or access to it. This means that we use other sources to gain information about the target like using the whois query, Nslookup, and so on. Suppose our target is an online...

Passive information gathering 1.0 – the traditional way


Let us deal with some of the most commonly used techniques for information gathering.

Getting ready

whois, Dig, and Nslookup are the three most basic and simplest steps for gaining initial information about our target. As both are passive techniques of gaining information, hence no connectivity with the target is required. These commands can be executed directly from the terminal of BackTrack. So, launch the terminal window and proceed further.

How to do it...

We will start our information gathering with a simple whois lookup. whois is an in-built command in BackTrack so we can directly invoke it from our terminal.

Let us quickly perform a whois lookup on www.packtpub.com and analyze the output. The output can be big, so here we will only focus on relevant points of the output.

root@bt:~# whois www.packtpub.com	
Domain Name: PACKTPUB.COM
   Registrar: EASYDNS TECHNOLOGIES, INC.
   Whois Server: whois.easydns.com
   Referral URL: http...

Passive information gathering 2.0 – the next level


Every security professional is aware of the information gathering techniques discussed in the previous recipe. But there are some techniques which analysts neglect because of their reduced popularity and awareness, but they can produce results as good as the previous techniques. The techniques we will discuss here will involve a deeper analysis of our target, though we will still be using a passive technique. These techniques do not require the use of Metasploit, but since information gathering is an important field for penetration testing, we will discuss it here.

Getting ready

We will understand three techniques here in this recipe:

  • Zone transfer: This can be performed using the terminal.

  • SMTP header: For this technique, we will require an e-mail that is sent by the target to the penetration tester.

  • Google dork: This is a simple, yet useful, technique of gaining information through a search engine.

Let us start with zone transfer.

How...

Port scanning – the Nmap way


Port scanning is an active information gathering technique in which we will now start dealing with our target directly. Port scanning is an interesting process of information gathering. It involves a deeper search of the target machine. Nmap is the most powerful and preferred scanner for security professionals. The usage of Nmap varies from novice to an advanced level. We will analyze the various scan techniques in detail.

Getting ready

Starting nmap from Metasploit is easy. Launch the msf console and type in nmap to display the list of scan options that Nmap provides.

msf > nmap

How to do it...

We will analyse four different types of Nmap scans which can be very helpful during penetration testing. Nmap provides lots of different modes for scanning the target machine. Here, we will focus on four scan types namely TCP connect scan, SYN stealth scan, UDP scan, and ACK scan. The different scan options of Nmap can also be combined in a single scan in order to perform...

Exploring auxiliary modules for scanning


Auxiliary modules are the in-built modules of a Metasploit that can help us perform a variety of tasks. They are different from exploits as they run on the pen-tester's machine and also it does not provide any shell. There are more than 350 different auxiliary modules present in the Metasploit framework, each having specific tasks. Here we will discuss the scanner auxiliary modules.

Getting ready

To use any auxiliary modules, we will have to follow three simple steps in order to make our module ready to launch. Let us go through the three-step process.

  1. Activating the module: The use command is used to set the particular module active and ready to take commands.

  2. Setting specifications: The set command is used to set up the various parameters that the module requires to execute.

  3. Running the module: After completing the first two steps, the run command is used to finally execute the module and generate the result.

To view the available scanning...

Target service scanning with auxiliary modules


Let us now try out some targeted scanning for specific services running on a range of IP addresses, or on a single target host. Various service-based scans are available; VNC, FTP, SMB, and so on. Auxiliary modules can be really handy in such situations when we are looking for specific types of services on our target.

Getting ready

Let us find out what service-based scanning auxiliary modules are available to us. We can navigate through the following path:

	
root@bt:/pentest/exploits/framework3/modules/auxiliary/scanner# ls
	
backdoor   emc 	ip    	mysql	pop3   	sap   ssh    	vnc
db2    	finger  lotus 	netbios  portscan   sip   telephony voice
dcerpc 	ftp 	misc  	nfs  	postgres   smb   telnet 	vxworks
dect   	http	motorola  ntp  	rogue  	smtp  tftp   	x11
discovery  imap	mssql 	oracle   rservices  snmp  upnp

As we can see, there are lots of options for service scan modules which can be very handy during penetration testing. Let us quickly work...

Vulnerability scanning with Nessus


So far, we have learned the basics of port scanning, along with the practical implementation with Nmap. Port scanning has been extended to several other tools which further enhance the process of scanning and information gathering. In the next few recipes, we will cover those tools which scan the target for available services and open ports and then tries to determine the type of vulnerability that may exist for that particular service or port. Let us begin our journey to vulnerability scanning.

Nessus is one of the most widely used vulnerability scanners. It scans the target for a range of vulnerabilities and produces a detailed report for it. Nessus is a very helpful tool during penetration testing. Either you can use the GUI version of Nessus, or you can also use it from the Metasploit console. In this book, we will primarily focus on using Nessus with msfconsole.

Getting ready

To start working with Nessus in msfconsole, we will have to load Nessus and...

Scanning with NeXpose


In the previous recipe, we discussed Nessus as a potential vulnerability scanner. In this recipe, we will cover another important vulnerability scanner NeXpose.

NeXpose is a popular tool by Rapid7 which performs the task of vulnerability scanning and importing results to the Metasploit database. The usage of NeXpose is similar to Nessus which we learned in the previous recipe, but let's have a quick overlook of how to get started with NeXpose. I will leave the task of exploring it deeper as an assignment for you.

Getting ready

To start the NeXpose from the msf console, we will first have to connect the database to Metasploit, and then load the plugin to connect it with the NeXpose server to start the process of target scanning. Let us execute these steps in the command line.

msf > db_connect msf3:8b826ac0@127.0.0.1:7175/msf3 

msf > load nexpose

msf > nexpose_connect darklord:toor@localhost ok

[*] Connecting to NeXpose instance at 127.0.0.1:3780 with username...

Sharing information with the Dradis framework


In our previous recipes, we learned several techniques for gaining information about our target. While performing penetration tests, we may need to share information with other pen-testers which may be located at other physical locations. In that case, sharing the penetration testing information can be made easier by using the Dradis framework. It is an open source framework for sharing information during security assessments. It has several features which makes it an excellent information-sharing tool. Some of them are:

  • Communicating over SSL

  • Attachment of files and notes

  • Import scan results from Nessus, NeXpose, and so on

  • Can be extended to connect with external systems like a vulnerability database

Although it will not help us in gaining any information about the target, the tool is important for all security professionals in sharing pen-test results and findings.

Getting ready

To launch the Dradis framework in BackTrack, we will have to execute...

Left arrow icon Right arrow icon

Key benefits

  • More than 80 recipes/practicaltasks that will escalate the reader's knowledge from beginner to an advanced level
  • Special focus on the latest operating systems, exploits, and penetration testing techniques
  • Detailed analysis of third party tools based on the Metasploit framework to enhance the penetration testing experience

Description

Metasploit® software helps security and IT professionals identify security issues, verify vulnerability mitigations, and manage expert-driven security assessments. Capabilities include smart exploitation, password auditing, web application scanning, and social engineering. Teams can collaborate in Metasploit and present their findings in consolidated reports. The goal of the software is to provide a clear understanding of the critical vulnerabilities in any environment and to manage those risks.Metasploit Penetration Testing Cookbook targets both professionals and beginners to the framework. The chapters of the book are logically arranged with an increasing level of complexity and cover Metasploit aspects ranging from pre-exploitation to the post-exploitation phase thoroughly. The recipe structure of the book provides a good mix of both theoretical understanding and practical implementation. This book will help readers in thinking from a hacker's perspective to dig out the flaws in target networks and also to leverage the powers of Metasploit to compromise them. It will take your penetration skills to the next level.The book starts with the basics such as gathering information about your target and gradually covers advanced topics like building your own framework scripts and modules. The book goes deep into operating systems-based penetration testing techniques and moves ahead with client-based exploitation methodologies. In the post- exploitation phase, it covers meterpreter, antivirus bypass, ruby wonders, exploit building, porting exploits to framework, and third party tools like armitage, and SET. Metasploit Penetration Testing Cookbook is the required guide to penetration testing and exploitation.

Who is this book for?

This book targets both professional penetration testers as well as new users of Metasploit who wish to gain expertise over the framework. The book requires basic knowledge of scanning, exploitation, and Ruby language.

What you will learn

  • Set up a complete penetration testing environment using metasploit and virtual machines
  • Learn to penetration-test popular operating systems such as Windows7, Windows 2008 Server, Ubuntu etc.
  • Get familiar with penetration testing based on client side exploitation techniques with detailed analysis of vulnerabilities and codes
  • Avail of exclusive coverage of antivirus bypassing techniques using metasploit
  • Master post-exploitation techniques such as exploring the target, keystrokes capturing, sniffing, pivoting, setting persistent connections etc.
  • Build and analyze meterpreter scripts in Ruby
  • Build and export exploits to framework
  • Use extension tools like Armitage, SET etc.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 22, 2012
Length: 268 pages
Edition : 1st
Language : English
ISBN-13 : 9781849517423
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 : Jun 22, 2012
Length: 268 pages
Edition : 1st
Language : English
ISBN-13 : 9781849517423
Category :
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 ₱260 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 ₱260 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 8,981.97
BackTrack 5 Wireless Penetration Testing Beginner's Guide
₱2806.99
Metasploit Penetration Testing Cookbook
₱2806.99
Advanced Penetration Testing for Highly-Secured Environments: The Ultimate Security Guide
₱3367.99
Total 8,981.97 Stars icon
Banner background image

Table of Contents

10 Chapters
Metasploit Quick Tips for Security Professionals Chevron down icon Chevron up icon
Information Gathering and Scanning Chevron down icon Chevron up icon
Operating System-based Vulnerability Assessment and Exploitation Chevron down icon Chevron up icon
Client-side Exploitation and Antivirus Bypass Chevron down icon Chevron up icon
Using Meterpreter to Explore the Compromised Target Chevron down icon Chevron up icon
Advanced Meterpreter Scripting Chevron down icon Chevron up icon
Working with Modules for Penetration Testing Chevron down icon Chevron up icon
Working with Exploits Chevron down icon Chevron up icon
Working with Armitage Chevron down icon Chevron up icon
Social Engineer Toolkit 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.9
(13 Ratings)
5 star 38.5%
4 star 46.2%
3 star 0%
2 star 0%
1 star 15.4%
Filter icon Filter
Top Reviews

Filter reviews by




Kindle Customer Nov 17, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Facebook is good to have your five good test your face challenges everybody is good and easy to understand how they work the tools you need and guys and the steps you can do very easy you do not need to read the book but to know the commands
Amazon Verified review Amazon
Howard Rayle Nov 16, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent information about how to get the most from Metasploit. Takes you through step by step with pictures of commands.
Amazon Verified review Amazon
Manoj Sep 11, 2012
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Metasploit penetration testing cookbook is a must have for security professionals and new learners of metasploit framework.The book is easy to grasp and flows from beginner to advance level smoothly. The reason which makes it a better guide is that it targets latest operating systems and also gives a detailed analysis of different exploit codes used in penetration testing. The book also coveres extra topics like Armitage, SET etc which further addes more power to the content of this book. To summerize, the book is a very handy guide to mastering the metasploit framework.
Amazon Verified review Amazon
Michael Mar 25, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
perfect in every aspect for some one avid enough to have found this program, but not necessarily know anything about it, written in easy to understand language and broken down nicely
Amazon Verified review Amazon
CNC guy Sep 11, 2012
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Overview: Singh provides an introduction to the widely used Metasploit framework in the form of seventy plus recipes for various penetration testing tasks. In a previous blog, I reviewed Dave Kennedy's Metasploit book. Both texts are well written. The format is different, however. Singh's book is written in a cookbook style which makes it easy to refer to it when attempting specific tasks. Kennedy's book is written in a more traditional style with an introduction and then survey of various aspects of Metasploit. The differences between these two books extends beyond format. Singh's book goes beyond a basic coverage of Metasploit and covers additional penetration testing tools such as various scanners and evasion tools. So which book should you buy if you had to pick just one? To me it mostly comes down to personal preference. If you are just learning Metasploit, either should be a great aid in this process. If you want a book you can refer back to later, the Singh book may be slightly more convenient. The publisher may also be a consideration. The Kennedy book is published by No Starch Press, whereas Singh's book is published by Packt. If you like eBooks you may prefer books from Packt Publishing. Packt provides DRM-free books in both PDF and ePub formats. This can be extremely convenient if you like to read your books on multiple devices. Personally I find myself reading books on my tablet and also keeping a copy on my penetration testing platform as a reference. Here is a brief table of contents for Singh's book:Chapter 1: Metasploit Quick Tips for Security Professionals covering: configuration, installation, basic use, and storing results in a databaseChapter 2: Information Gathering and Scanning covering: passive and active gathering, social engineering, scanning, Nessus, NeXpose, and DradisChapter 3: Operating System-based Vulnerability Assessment covering: exploits, Windows XP, remote shells, Windows 2003, Windows 7, Linux, and DLL injectionChapter 4: Client-side Exploitation and Antivirus bypass covering: IE, Word, Adobe Reader, payloads, and killing anti-virusChapter 5: Using Meterpreter to Explore the Compromised Target covering: Meterpreter commands, privilege escalation, communication channels, and snooping on Windows targetsChapter 6: Advanced Meterpreter Scripting covering: hash dumps, back doors, pivoting, Railgun, pivoting, and killing firewallsChapter 7: Working with Modules for Penetration Testing covering: Auxiliary modules, admin modules, SQL injection, post-exploitation, and creating new modulesChapter 8: Working with Exploits covering: mixins, msfvenum, going from exploit to Metasploit module, and fuzzingChapter 9: Working with Armitage covering: Getting started, information gathering, and targeting multiple machinesChapter 10: Social Engineering Toolkit covering: Installation, configuration, spear-phishing, website attacks, and infectious media generationTo summarize, if you are looking for a Metasploit book in cookbook format than this book would be a good choice.cross-posted from [..]
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.