# sudo apt-get install python-scapy tcpdump tcpreplay wireshark # Note that wireshark prompts during installation if non-root users # should be allowed to perform packed capture. from scapy.all import * import os #import requests DASH_MAC_ADDRESS=os.environ.get('DASH_MAC_ADDRESS') DASH_INTERFACE=os.environ.get('DASH_INTERFACE') #URL_CALLBACK=os.environ.get('URL_CALLBACK') def arp_display(pkt): if pkt[ARP].op == 1: #who-has (request) if pkt[ARP].hwsrc == DASH_MAC_ADDRESS: #requests.get(URL_CALLBACK) print "ARP from " + pkt[ARP].hwsrc + " " + pkt[ARP].psrc else: print "ARP Probe from unknown device: " + pkt[ARP].hwsrc + " " + pkt[ARP].psrc # end if # end if # end apr_display while True: try: print sniff(prn=arp_display, iface=DASH_INTERFACE, filter="arp", store=0, count=10) except: pass # end try # end while