How to do it...

The following steps demonstrate the automation of Metasploit:

  1. We start Metasploit using the following command:
        msfconsole 

The preceding command's output is shown in the following screenshot:

  1. 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:

  1. Now we run the script using the following command:
        resource /usr/share/metasploit-framework
/scripts/resource/basic_discovery.rc
  1. This script will do a basic host discovery scan on the subnet provided: