Skip to content

Instantly share code, notes, and snippets.

@thepacketgeek
Last active May 31, 2018 20:32
Show Gist options
  • Save thepacketgeek/6919284 to your computer and use it in GitHub Desktop.
Save thepacketgeek/6919284 to your computer and use it in GitHub Desktop.
Scapy - Monitor ARP traffic on network with custom console output
from scapy.all import *
def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
return "Request: " + pkt[ARP].psrc + " is asking about " + pkt[ARP].pdst
if pkt[ARP].op == 2: #is-at (response)
return "*Response: " + pkt[ARP].hwsrc + " has address " + pkt[ARP].psrc
print sniff(prn=arp_display, filter="arp", store=0, count=10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment