How can I capture packets with python3? I would like to emphasize that my goal is not to listen to traffic, but to capture it. For instance, the Python Scapy module has a sniff function that allows you to listen to the traffic, but not to capture it. Is there a function that allows me to capture a packet so that I can determine whether to send it or not?
To capture traffic you just save what you sniffed.
from scapy.all import *
wrpcap("somefile.pcap", sniff(iface='yourInterface', count=100))