Sample Header Ad - 728x90

Using Python and Scapy to sniff for ARP on Pi

12 votes
4 answers
14320 views
I'm trying to use a Raspberry Pi to find ARP requests from a specific wireless device on my network. It's one of those Amazon dash buttons. Someone used this code to listen to when the dash connects to 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) When I run this on Raspbian (with python and scapy installed), I get an error "IndexError: Layer [ARP] not found" I'm totally unfamiliar with scapy and just diving in for the first time. Thanks for any ideas.
Asked by user851 (121 rep)
Aug 14, 2015, 03:28 PM
Last activity: Jun 25, 2017, 08:56 AM