Using subprocess and re might be the best way to go here, unless you’re interested in reimplementing those tools in Python. On pypi I found this which seems to wrap nmap: python-nmap · PyPI
Yes. What I meant was, use subprocess to run nmap and then use regular expressions to parse the strings it returns to collect the information you want.
This isn’t a Python question. Do you know how you’re actually planning to do the scan? If not, use existing tools, and just use Python to parse their output - which means, the first step is to understand the tools you’re using.