Scapy没有发送数据包。

5
我尝试创建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")

输出结果为:
    "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

它说 winpcap未安装。 你尝试过安装winpcap吗? - Ross Jacobs
3个回答

1

从这个链接https://www.winpcap.org/install/下载并安装WinPcap,然后再次运行您的程序。

注意:如果您正在使用命令行终端运行程序,则必须关闭并重新启动终端窗口。


0

使用以下命令初始化第三层嗅探器: conf.L3Socket= L3RawSocket; 这将有助于您进行嗅探过程...因为嗅探器需要原始套接字来实现其功能。


0

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接