pip install python-nmap
This is a python class to use nmap and access scan results from python3
python-nmap is a python library that helps in using nmap port scanner. It allows to easily manipulate nmap scan results and will be a perfect tool for systems administrators who want to automatize scanning tasks and reports. It also supports nmap script outputs.
It can even be used asynchronously. Results are returned one host at a time to a callback function defined by the user.