[python]Intrusive python with nmap

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.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s