This recipe is written for a Linux machine. So, this script will not run on a Windows or macOS host. In this recipe, we use Nmap, a famous network scanning tool. You can find more about Nmap from its website http://nmap.org/.
Install Nmap in your computer. For Debian-based systems, the command is:
$ sudo apt-get install nmap
You also need the python-nmap module to run this recipe. This can be installed by pip, as follows:
$ pip install python-nmap