上QQ阅读APP看书,第一时间看更新
Checking for hosts and services in MSF
So far, we have covered the basics of msfconsole. Now, let's move on and learn how to manage hosts and services:
- To view a list of all hosts that have been added, use the hosts command:
- To add a new host, we can use the hosts -a <IP> command, as shown in the following screenshot:
- To remove a host, we use the hosts -d <IP> command, as shown in the following screenshot:
Similarly, the services command allows us to view a list of all the services that are available across all the hosts that have been added to Metasploit. Let's take a look:
- First, we need to use the services command:
- To view the list of services for a single host, we can use the services <IP> command, as shown in the following screenshot:
We cannot add multiple ports at once. Doing that will throw an error – Exactly one port required – as shown in the preceding screenshot.
Metasploit also allows us to add a custom service manually by using the services -a -p <port number> command, as shown in the following screenshot:
Next, let's look at Nmap scanning with MSF.