我正在尝试使用 Raspberry Pi 查找来自我网络上特定无线设备的 ARP 请求。它是亚马逊仪表板按钮之一。有人使用此代码来收听仪表板何时连接到 wifi。
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
if pkt[ARP].hwsrc == '74:75:48:5f:99:30': # button 1
print "Pushed Huggies"
elif pkt[ARP].hwsrc == '10:ae:60:00:4d:f3': # button 2
print "Pushed Elements"
else:
print "ARP Probe from unknown device: " + pkt[ARP].hwsrc
print sniff(prn=arp_display, filter="arp", store=0, count=10)
Run Code Online (Sandbox Code Playgroud)
当我在 Raspbian(安装了 python 和 scapy)上运行它时,出现错误
"IndexError: Layer [ARP] not found"
Run Code Online (Sandbox Code Playgroud)
我完全不熟悉 scapy,只是第一次潜水。感谢您的任何想法。