This is just a quick follow-up post to accompany the previous Importing packets from trace files with scapy post. So you’ve sniffed or generated some packets with scapy and it’s time to write them to file to analyze and double-check your work. Here’s a simple example of how to save those packets.
localhost:~ packetgeek$ scapy
Welcome to Scapy (2.3.1)
>>> packets = sniff(count=10)
<Sniffed: TCP:0 UDP:3 ICMP:0 Other:7>
Tada! That’s it. There’s no options or special functions, you probably should do your packet processing before you write the packets to file.