Skip to content

Instantly share code, notes, and snippets.

@MJGTwo
Forked from eob/dash-listen-1.py
Last active November 2, 2015 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MJGTwo/8d039f2c0e417faf9d64 to your computer and use it in GitHub Desktop.
Save MJGTwo/8d039f2c0e417faf9d64 to your computer and use it in GitHub Desktop.
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)#Surpress's small errors from Scapy
from scapy.all import *
def arp_display(pkt):
if pkt.haslayer(ARP): #makes sure it is ARP
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print "ARP Probe from: " + pkt[ARP].hwsrc
print sniff(prn=arp_display, filter="arp", store=0, count=0)
@MJGTwo
Copy link
Author

MJGTwo commented Nov 2, 2015

I noticed a few errors in while running a version of this on my
Raspberry Pi. One of them is that Scapy likes to through low level
errors that cause the program to crash. Another is when Scapy receives
a packet that isn’t ARP and tries to use ARP features on it and
crashes, so I made it check for that. Lastly I changed the count to 0
so that it runs until you tell it to stop with a Ctrl+C command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment