One can more easily understand the Metasploit architecture by taking a look under its hood. In learning how to use Metasploit, take some time to make yourself familiar with its filesystem and libraries. In Kali Linux, Metasploit is provided in the metasploit-framework package and is installed in the /usr/share/metasploit-framework directory, the top-level of which is shown below.
The Metasploit filesystem
The MSF filesystem is laid out in an intuitive manner and is organized by directory. Some of the more important directories are briefly outlined below.
The data directory contains editable files used by Metasploit to store binaries required for certain exploits, wordlists, images, and more.
The scripts directory contains Meterpreter and other scripts.
root@kali:~# ls /usr/share/metasploit-framework/scripts/
meterpreter ps resource shell
The tools directory has various useful command-line utilities.
root@kali:~# ls /usr/share/metasploit-framework/tools/
context dev exploit hardware memdump modules password recon
There are a number of MSF libraries that allow us to run our exploits without having to write additional code for rudimentary tasks, such as HTTP requests or encoding of payloads. Some of the most important libraries are outlined below.
The basic library for most tasks
Handles sockets, protocols, text transformations, and others
Throughout this course, we will touch upon how to use other tools directly within Metasploit. Understanding how things are stored and related to the Metasploit filesystem will help you in using the msfconsole and the other Metasploit interfaces.