# 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): print pkt[ARP].hwsrc + " " + pkt[ARP].psrc + " op:" + str(pkt[ARP].op) if pkt[ARP].op == 1: #who-has (request) if pkt[ARP].psrc == '0.0.0.0': # ARP Probe if pkt[ARP].hwsrc == DASH_MAC_ADDRESS: #requests.get(URL_CALLBACK) print "ARP from " + pkt[ARP].hwsrc else: print "ARP Probe from unknown device: " + pkt[ARP].hwsrc # end if # end if # end if # end apr_display #while True: # try: # print sniff(prn=arp_display, iface="eth0", filter="arp", store=0, count=10) # except: # pass # # end try # end while print sniff(prn=arp_display, iface=DASH_INTERFACE, filter="arp", store=0, count=10)