0

I have a simple sniffer of packets using Python and pcapy.

pc = pcapy.open_live(str(self.port), max_bytes, promiscuous, read_timeout)
#My problem is here
pc.setfilter('???')
pc.loop(-1, self.recv_pkts) 

I need to drop all IPv6 packets and capture everything else (including pure L2 packets etc). It should be possible to do so using setfilter() function, however I can't find any example of how to pass everything besides. I really don't want to manually parse each packet in python and check that it's not IPv6

Anto
  • 6,806
  • 8
  • 43
  • 65
Konstantin
  • 2,937
  • 10
  • 41
  • 58

1 Answers1

1
pc.setfilter('not ip6')

Reference: http://www.tcpdump.org/manpages/pcap-filter.7.html

Robᵩ
  • 163,533
  • 20
  • 239
  • 308