Advertisement
Guest User

Untitled

a guest
Feb 11th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. import nmap
  2.  
  3. nm = nmap.PortScanner()
  4.  
  5. nm.scan('127.0.0.1', '80')
  6. nm.command_line()
  7. nm.scaninfo()
  8.  
  9. for host in nm.all_hosts():
  10.     print('----------------------------------------------------')
  11.     print('Host : %s (%s)' % (host, nm[host].hostname()))
  12.     print('State : %s' % nm[host].state())
  13.     for proto in nm[host].all_protocols():
  14.         print('----------')
  15.         print('Protocol : %s' % proto)
  16.  
  17.         lport = nm[host][proto].keys()
  18.         lport.sort()
  19.         for port in lport:
  20.                 print('port : '+port+'\tstate : '+ nm[host][proto][port]['state'])
  21.                 print('----------------------------------------------------')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement