scapy 没有发送数据包

Rak*_*lah 5 python scapy python-3.x

我尝试创建 scapy 工具来测试嗅探,这是我的代码:

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")
Run Code Online (Sandbox Code Playgroud)

输出是:

    "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
Run Code Online (Sandbox Code Playgroud)

小智 0

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