python读取网络端口数据_python编写端口扫描

python读取网络端口数据_python编写端口扫描

一段IP地址端口的扫描用python怎么写代码阿

import socket

def scan(host, start_port=1, end_port=65535):

    result = []

    while start_port = end_port:

        # print 'scanning %d' % start_port

        sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

281 0 2023-01-14 端口扫描