Metasploit supports automation in different ways. One such way we will cover here is resource script.
A resource script is basically a set of commands that run automatically when a script is loaded. Metasploit already contains a set of prebuilt scripts that prove to be most useful in a corporate pentesting environment. The complete list of scripts available can be seen in the /usr/share/metasploit-framework/scripts/resource
directory:
The following steps demonstrate the automation of Metasploit:
- We start Metasploit using the following command:
msfconsole
The preceding command's output is shown in the following screenshot:
- Some scripts require
RHOSTS
to be set globally, so we setRHOSTS
using the following command:
set RHOSTS 172.18.0.0/24
The preceding command's output is shown in the following screenshot:
- Now we run the script using the following command:
resource /usr/share/metasploit-framework
/scripts/resource/basic_discovery.rc
- This script will do a...