The modules that exist in the Metasploit Framework are
represented as files in specific directories.
Let's look at the file system layout of Metasploit.
In most deployments of the Metasploit Framework,
you'll find the following directory hierarchy. Under the framework directory,
you'll see these subdirectories. Lib for libraries.
Here you'll find the internal libraries that Metasploit uses. These
will be helpful if you write your own scanners,
exploits, or payloads.
Modules contains all of the Metasploit modules.
We'll look more closely at that one momentarily. Plugins holds
the integration code for third‑party tools.
Scripts has various scripts that you can utilize during testing.
There are other directories under the framework as well.
Most are internal to Metasploit.
The modules directory is where the included modules for Metasploit are found.
Auxiliary holds several hundred modules for scanning,
information gathering, and other functions.
Encoders, evasion, and nops hold various components for
building and obfuscating payloads.
Exploits contains the vulnerability exploit code. Payloads is
where you find the functional payload code. And finally, post
contains the post‑exploitation modules.
Metasploit can also load modules outside of those
included within the Metasploit Framework.
This might be useful if you're developing your own set of modules or
are using a collection of modules in a team setting. In your home
directory on a Linux or a macOS system,
Metasploit creates a directory named .msf4 when you first run
msfconsole. Under that directory is an empty modules directory
where you can develop your own modules.
You just need to create the appropriate subdirectories as
needed so that Metasploit can find your module.
You can also specify a separate directory structure of modules when you
start msfconsole with a ‑m option and the module directory.
Once inside the msfconsole,
there's a loadpath command where you can specify the path to load new
modules and a reload_all command to force Metasploit to reload the
defined module paths and index all of the modules.