Skip to content

Instantly share code, notes, and snippets.

@vogler
Created April 5, 2017 19:01
Show Gist options
  • Save vogler/91a9f4a7dce12a212068efdfdffd53da to your computer and use it in GitHub Desktop.
Save vogler/91a9f4a7dce12a212068efdfdffd53da to your computer and use it in GitHub Desktop.
detects dash button presses
from scapy.all import *
from datetime import datetime
# blocked these macs in router to avoid notifications. however, this makes them try longer.
# fake server: https://github.com/ide/dash-button/issues/59
# maybe set google as primary dns and rpi as secondary: https://medium.com/@tombatossals/cheating-the-amazon-dash-iot-button-the-almost-easy-way-e5bc62f93f8c
macs = {
"ac:63:be:ea:5b:1b": "kleenex",
"ac:63:be:ba:2f:85": "oral-b"
}
def udp_filter(p):
# print p.show()
if p[IP].id == 1:
print datetime.now(), macs[p.src], p.summary()
sniff(prn=udp_filter, filter="udp", iface="wlan0", store=0, lfilter=lambda x: x.src in macs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment