The first step of most hacks is identifying the machine that we want to connect to. Each machine is identified by a unique IP address. In this section, we will discover the IP address of the Metasploitable 2 server using NetDiscover.
What is NetDiscover?
Netdiscover is an active/passive ARP reconnaissance tool, initially developed to gain information about wireless networks without DHCP servers in wardriving scenarios. It can also be used on switched networks. Built on top of libnet and libpcap, it can passively detect online hosts or search for them by sending ARP requests.
Furthermore, it can be used to inspect your network's ARP traffic or find network addresses using the auto-scan mode, which will scan for common local networks.
NetDiscover comes pre-installed with the ParrotSec Operating system. Use the help command to find out more information about its usage.
Using NetDiscover
Follow the below instructions to find out the IP address of your target machine with the help of NetDiscover:
Step 1: Find out the interface name
To know the interface name run the ifconfig command on your terminal:
You can see 4 interfaces connected to your network:
- eth0: If your network is connected through an Ethernet cable.
- lo0: This signifies that you are connected with a local network i.e., 127.0.0.1
- vboxnet0: If your network is within the VirtualBox.
- wlan0: If you are connected with wifi.
Note: This may vary with your computer. In real-world hacking, it is important to know the working structure of a network. To learn more about networks to understand them in a better way.
As our Metasploitable 2 is installed within Virtualbox so the interface is vboxnet0.
Step 2: Discover the network
If you have found out your interface name then, run the following command on your terminal:
After a couple of minutes, netdiscover should have captured 2 hosts and their IP addresses that are running within this network.
(IMPORTANT: This IP will be different for everyone. You need to use the IP Address that is output in your terminal.)
Great now that you have the IP Addresses, but the confusion is which is the Metasploit server. You can find out your answer in the next chapter.