Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # python host.py
- # skip420@skip420:~/Desktop$ python host.py
- # Enter the host to be scanned: "www.yahoo.com"
- # ('Starting scan on host: ', '202.165.107.49')
- from socket import *
- import time
- startTime = time.time()
- if __name__ == '__main__':
- target = input('Enter the host to be scanned: ')
- t_IP = gethostbyname(target)
- print ('Starting scan on host: ', t_IP)
- for i in range(50, 500):
- s = socket(AF_INET, SOCK_STREAM)
- conn = s.connect_ex((t_IP, i))
- if(conn == 0) :
- print ('Port %d: OPEN' % (i,))
- s.close()
- print('Time taken:', time.time() - startTime)
Advertisement
Advertisement