1import socket
2host = "localhost"
3ports = [21,22,23,24,25,110,80,443] # Add Port
4for port in ports:
5 s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
6 p = s.connect_ex((host,port))
7 if p == 0:
8 print(f"Port: {port} Open!")
9 else:
10 print(f"Port: {port} Filter!")
11