Book Image

Metasploit Penetration Testing Cookbook

By : Abhinav Singh
Book Image

Metasploit Penetration Testing Cookbook

By: Abhinav Singh

Overview of this book

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.
Table of Contents (17 chapters)
Metasploit Penetration Testing Cookbook
About the Author
About the Reviewers

Analyzing the stored results of the database

After storing the testing results in the database, the next step is to analyze it. Analyzing the data will give us a deeper understanding of our target systems. The results of the database can be kept either for a long time or for a short time storage depending upon the usage.

Getting ready

Launch msfconsole and follow the steps mentioned in the previous recipe to establish the database connectivity. We can either use it to store fresh results or analyze the previously stored results as well. The XML file for the Nmap scan created in the previous recipe can be imported to analyze the previous scan results.

How to do it...

Let us analyze some of the important commands to have a clearer understanding of the stored results:

  • msf > hosts: This command will show all the hosts that are available in the database. Let us analyze the output of this command:

    The preceding screenshot snapshot reflects the output of the hosts command. As we can observe, the result of this command is not very clean, as there are lots of columns in the table. So we can move ahead and add filters and view only those columns which we are interested in, as illustrated by the following command :

    msf > hosts -c address,os_name
    address       	   os_name
    -------     	   ------  Microsoft Windows  Linux
  • msf > services: This is another interesting command that can give us useful information about the different services running on the target machines:

    msf > services
    host        	port  proto  name      	state      info
    ----        	----  -----  ----      	-----      ----  111   tcp	rpcbind   	open  135   tcp	msrpc     	open  139   tcp	netbios-ssn   open  445   tcp	microsoft-ds  open  135   tcp	msrpc     	open   Microsoft Windows RPC
  • msf > vulns: This command lists all the vulnerabilities that exist in the hosts present in the database.

  • msf > db_autopwn: This is a powerful command that is used to automate the process of exploiting the target machines that are available in the database. This command requires more understanding about the exploitation process so we will analyze this command later.

How it works...

The analysis process is simple and can be easily filtered to get the desired results. We have seen how to read the database output and how we can manage it efficiently. The last two commands, vulns and db_autopwn are post-exploitation commands, which we will deal with in later chapters.