0

I am trying to sniff ARP traffic on the network and I'm using scapy.sniff() for the purpose. Following is the code I have written to do this.

#! /usr/bin/python3
from scapy.all import *
import logging as log

def arp_display(pkt):
    #if pkt[ARP].op == 1: #who-has (request)
        #return f"Request: {pkt[ARP].psrc} is asking about {pkt[ARP].pdst}"
    if pkt[ARP].op == 2: #is-at (response)
        return f"*Response: {pkt[ARP].hwsrc} has address {pkt[ARP].psrc}"

sniff(prn=arp_display, filter="arp", store=0, iface='eth0', count=5)

Issue is, it does not capture traffic unless I define the 'count' parameter in 'sniff' function. And the generated ARP requests should be greater than and equal to 'count', otherwise It shows nothing. It want to monitor the ARP requests on the network continuously.

Zaid
  • 79
  • 10

0 Answers0