Portscan z Pythonem

import socket
host = "localhost"
ports = [21,22,23,24,25,110,80,443] # Add Port
for port in ports:
  s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
  p = s.connect_ex((host,port))
  if p == 0:
    print(f"Port: {port} Open!")
  else:
    print(f"Port: {port} Filter!")
Perfect Pig