nmap with Python

This section is dedicated to the nmap lovers. You can use nmap in Python. You just need to install the python-nmap module and nmap. The command to install them is very simple. By using pip, we can install python-nmap

pip install python-nmap

After installing the python-nmap module, you can check the nmap module by importing it. If there is no error while importing, then it means that it was successfully installed. Let's check what is inside in nmap:

>>>import nmap>>> dir(nmap)['ET', 'PortScanner', 'PortScannerAsync', 'PortScannerError', 'PortScannerHostDict', 'PortScannerYield', 'Process', '__author__', '__builtins__', '__doc__', '__file__', '__last_modification__', '__name__', '__package__', '__path__', '__version__', 'convert_nmap_output_to_encoding', ...

Get Python Penetration Testing Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.