好的,以下是一个简单的 Python 端口扫描工具代码:
import socket
def port_scanner(host, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(1)
try:
con = s.connect((host, port))
print(f'Port {port} is open')
con.close()
except:
print(f'Port