Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlessandroVaccarino/d574aeddd92736ef8a21d0ab4f3a1d6e to your computer and use it in GitHub Desktop.
Save AlessandroVaccarino/d574aeddd92736ef8a21d0ab4f3a1d6e to your computer and use it in GitHub Desktop.
Fast Python code, aimed to detect Amazon Dush button pressings. Please note: needs to be run as root
from scapy.layers.dhcp import DHCP
from scapy.layers.l2 import Ether
from scapy.sendrecv import sniff
MAC_ADDRESS_BTN1 = "xx:xx:xx:xx:xx:xx"
def detect_button(pkt):
if pkt.haslayer(DHCP):
if pkt[Ether].src.upper() == MAC_ADDRESS_BTN1.upper():
print("Plasmon button pressed! What to do, now?")
else:
print("Button " + pkt[Ether].src.upper() + " detected, but now known!")
print("Process started. Waiting for buttons...")
sniff(prn=detect_button, filter="", store=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment