Skip to content

Instantly share code, notes, and snippets.

@maugern
Last active April 10, 2018 11:32
Show Gist options
  • Save maugern/f1be7d05f29313f585e2d92bc7f91377 to your computer and use it in GitHub Desktop.
Save maugern/f1be7d05f29313f585e2d92bc7f91377 to your computer and use it in GitHub Desktop.
Sniffing ARP response
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from scapy.all import *
# Sniffing ARP response
counter = 0
def display_arp(packet):
global counter
if packet[ARP].op == 2: # is a response
counter += 1
return ('Response n°{}: {} has address {}'.format(counter,
packet[ARP].hwsrc,
packet[ARP].psrc))
sniff(prn=display_arp, filter="arp", store=0, count=10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment