原理:利用socket回话,只连接耳不收发任何信息
from socket import *
def scan(host,port):
try:
soc = socket((host,port))
soc.connect()
print(f"the port {host} is open")
if __name__ == '__main__':
host = input("enter a ipv4 address: ")
for port in range(2**16):
scan(host,port)
print("scan done")