Guest User

Untitled

a guest
Feb 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. from socket import *
  2.  
  3. if __name__ == '__main__':
  4. target = raw_input('Enter host to scan: ')
  5. targetIP = gethostbyname(target)
  6. print 'Starting scan on host ', targetIP
  7.  
  8. #scan reserved ports
  9. for i in range(20, 1025):
  10. s = socket(AF_INET, SOCK_STREAM)
  11. result = s.connect_ex((targetIP, i))
  12. if(result == 0) :
  13. print 'Port %d: OPEN' % (i,)
  14. s.close()
Add Comment
Please, Sign In to add comment