实验机器IP:192.168.220.139,端口开放情况
代码
# -*- coding:utf-8 -*- __author__ = "MuT6 Sch01aR" import socket def PortScan(ip, port): try: connSkt = socket.socket() connSkt.connect((ip,port)) print('[+]%d open'%port) connSkt.close() except: print('[-]%d close' %port) PortScan('192.168.220.139',7909)
运行结果