scapy没有发送数据包

问题描述 投票:1回答:1

我尝试创建用于测试嗅探的简便工具,这是我的代码:

def scan(ip):
    arp_req = sc.ARP(pdst=ip)
    bc = sc.Ether(dst="ff:ff:ff:ff:ff:ff")
    arp_req_bc = bc/arp_req
    answer = sc.srp(arp_req_bc, timeout=1, verbose=True)[0]
    print("IP\t\t\tMAC Address\n-----------------------")
    for element in answer:
        print(element[1].psrc + "\t\t" + element[1].hwsrc)

scan("192.168.43.1/24")

输出为:

    "Sniffing and sending packets is not available at layer 2: "
RuntimeError: Sniffing and sending packets is not available at layer 2: winpcap is not installed. You may use conf.L3socket orconf.L3socket6 to access layer 3
python python-3.x scapy
1个回答
0
投票

要在Windows中使用scapy模块,首先需要安装npcap或wincap。

© www.soinside.com 2019 - 2024. All rights reserved.