The loadpath command

While developing modules for Metasploit, we place the modules in their corresponding categories folder. However, once Metasploit is updated, all the modules are deleted and we have to replace them in their corresponding folders every time an update occurs. To overcome this constraint, we can create a directory outside Metasploit's primary directory and can load modules from there. The advantage of doing this lies in the fact that custom modules will not be lost at the time when Metasploit updates.

In the following example, we copy all the modules to the desktop in a directory called mods. However, we need to replicate the directory structure of Metasploit under mods directory, in order to use modules virtually from Metasploit's directory. This means that the loaded path will become a virtual branch of the Metasploit's directory structure. Let's have a look at loading custom paths into Metasploit, as shown in the following screenshot:

The loadpath command

In the preceding screenshot, we placed our modules in the mods directory on the Desktop in the exploits/misc folder. Now, whenever we load our custom path into Metasploit, our modules will be available in the exploit/misc directory. Let's load the path into Metasploit as shown in the following screenshot:

The loadpath command

We can see that our modules are loaded successfully. Let's see if they are available to use under Metasploit in the following screenshot:

The loadpath command

In the preceding screenshot, we can see that our modules are available to use in Metasploit. Therefore, no matter how many times the Metasploit updates, our custom modules will not be lost and can be loaded as many times we want, thus saving the time of copying all the modules one after the other into their respective directories.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.126.11