Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import nmap
- nm = nmap.PortScanner()
- nm.scan('127.0.0.1', '80')
- nm.command_line()
- nm.scaninfo()
- for host in nm.all_hosts():
- print('----------------------------------------------------')
- print('Host : %s (%s)' % (host, nm[host].hostname()))
- print('State : %s' % nm[host].state())
- for proto in nm[host].all_protocols():
- print('----------')
- print('Protocol : %s' % proto)
- lport = nm[host][proto].keys()
- lport.sort()
- for port in lport:
- print('port : '+port+'\tstate : '+ nm[host][proto][port]['state'])
- print('----------------------------------------------------')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement