Unlock the power of network exploration with Python as we delve into the world of open ports. In this project, you’ll learn how to create a Python script to scan and identify open ports on a target host or network. Understanding open ports is crucial for network security, system administration, and more. This guide is suitable for both newcomers and experienced Python developers. Join us as we embark on a journey to discover open doors in the digital landscape through Python scripting
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)
Latest posts by Publisher (see all)
- Age calculator using Javascript, HTML & CSS - October 28, 2023
- Navigation bar using HTML & CSS - October 26, 2023
- Calculator using HTML, CSS & JS - October 26, 2023