Just got a new python-nmap installed, and nmap installed on my mac, did a small try out on manipulating the result.
here’s the code:
import nmap host = '192.168.1.150' nm = nmap.PortScanner() nm.scan(host, '22') state = nm[host]['tcp'][22]['state'] print("{} tcp/22 is {}".format(host,state))
I will be trying out the full scan capability with the codes, the above is just a try out… the actual usage would need to do some iteration with a for loop.