import socketfor port in range(1,65536): try: conn= socket.socket(2,1) conn.connect('192.168.1.100',port) print ('Tcp port %d is open' %port) except: pass
5 回答
Camel97
TA贡献49条经验 获得超38个赞
import socket for port in range(1,65536): try: conn = socket.socket(2 , 1) conn.connect('192.168.1.100' , port) print ('Tcp port %d is open'%port) except: pass finally: conn.close()
添加回答
举报
0/150
提交
取消