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 set RHOSTS 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 basic host discovery scan on the subnet provided:
