Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Metasploit for Beginners

You're reading from  Metasploit for Beginners

Product type Book
Published in Jul 2017
Publisher Packt
ISBN-13 9781788295970
Pages 190 pages
Edition 1st Edition
Languages
Author (1):
Sagar Rahalkar Sagar Rahalkar
Profile icon Sagar Rahalkar

Table of Contents (11) Chapters

Preface 1. Introduction to Metasploit and Supporting Tools 2. Setting up Your Environment 3. Metasploit Components and Environment Configuration 4. Information Gathering with Metasploit 5. Vulnerability Hunting with Metasploit 6. Client-side Attacks with Metasploit 7. Web Application Scanning with Metasploit 8. Antivirus Evasion and Anti-Forensics 9. Cyber Attack Management with Armitage 10. Extending Metasploit and Exploit Development

Metasploit Components and Environment Configuration

For any tool that we use to perform a particular task, it's always helpful to know that tool inside out. A detailed understanding of the tool enables us to use it aptly, making it perform to the fullest of its capability. Now that you have learned some of the absolute basics of the Metasploit Framework and its installation, in this chapter, you will learn how the Metasploit Framework is structured and what the various components of the Metasploit ecosystem. The following topics will be covered in this chapter:

  • Anatomy and structure of Metasploit
  • Metasploit components--auxiliaries, exploits, encoders, payloads, and post
  • Getting started with msfconsole and common commands
  • Configuring local and global variables
  • Updating the framework

Anatomy and structure of Metasploit

The best way to learn the structure of Metasploit is to browse through its directory. When using a Kali Linux, the Metasploit Framework is usually located at path /usr/share/metasploit-framework, as shown in the following screenshot:

At a broad level, the Metasploit Framework structure is as shown in the following screenshot:

The Metasploit Framework has a very clear and well-defined structure, and the tools/utilities within the framework are organized based on their relevance in various phases of the penetration testing life cycle. We'll be using tools/utilities from each of these categories as we progress through the book.

In the next section, we'll have a brief overview of all the Metasploit components.

Metasploit components

The Metasploit Framework has various component categories based on their role in the penetration testing phases. The following sections will provide a detailed understanding of what each component category is responsible for.

Auxiliaries

You have learned so far that Metasploit is a complete penetration testing framework and not just a tool. When we call it a framework, it means that it consists of many useful tools and utilities. Auxiliary modules in the Metasploit Framework are nothing but small pieces of code that are meant to perform a specific task (in the scope of our penetration testing life cycle). For example, you might need to perform a simple task of verifying whether a certificate of a particular...

Playing around with msfconsole

Now that we have a basic understanding of the structure of the Metasploit Framework, let's get started with the basics of msfconsole practically.

The msfconsole is nothing but a simple command-line interface of the Metasploit Framework. Though msfconsole may appear a bit complex initially, it is the easiest and most flexible way to interact with the Metasploit Framework. We'll use msfconsole for interacting with the Metasploit framework throughout the course of this book.

Some of the Metasploit editions do offer GUI and a web-based interface. However, from a learning perspective, it's always recommended to master the command-line console of the Metasploit Framework that is msfconsole.

Let's look at some of the msfconsole commands:

  • The banner command: The banner command is a very simple command used to display the Metasploit Framework...

Variables in Metasploit

For most exploits that we use within the Metasploit Framework, we need to set values to some of the variables. The following are some of the common and most important variables in the Metasploit Framework:

Variable name Variable description
LHOST Local Host: This variable contains the IP address of the attacker's system that is the IP address of the system from where we are initiating the exploit.
LPORT Local Port: This variable contains the (local) port number of the attacker's system. This is typically needed when we are expecting our exploit to give us reverse shell.
RHOST Remote Host: This variable contains the IP address of our target system.
RPORT Remote Port: This variable contains the port number on the target system that we will attack/exploit. For example, for exploiting an FTP vulnerability on a remote target system, RPORT...

Updating the Metasploit Framework

The Metasploit Framework is commercially backed by Rapid 7 and has a very active development community. New vulnerabilities are discovered almost on a daily basis in various systems. For any such newly discovered vulnerability, there's quite a possibility that you get a ready-to-use exploit in the Metasploit Framework. However, in order to keep abreast with the latest vulnerabilities and exploits, it's important to keep the Metasploit Framework updated. You may not need to update the framework on a daily basis (unless you are very actively involved in penetration testing); however, you can target for weekly updates.

The Metasploit Framework offers a simple utility called msfupdate that connects to the respective online repository and fetches the updates:

Summary

In this chapter, we have seen how the Metasploit Framework is structured and some common console commands. In the next chapter, we'll practically start using the Metasploit Framework for performing information gathering and enumeration on our target systems. For using most modules within the Metasploit Framework, remember the following sequence:

  1. Use the use command to select the required Metasploit module.
  2. Use the show options command to list what all variables are required in order to execute the selected module.
  3. Use the set command to set the values for required variables.
  4. Use the run command to execute the module with the variables configured earlier.

Exercises

You can try the following exercises:

  • Browse through the directory structure of the Metasploit Framework
  • Try out some of the common console commands discussed in this chapter
  • Update the Metasploit Framework to the latest available version
lock icon The rest of the chapter is locked
You have been reading a chapter from
Metasploit for Beginners
Published in: Jul 2017 Publisher: Packt ISBN-13: 9781788295970
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}