@conf.commands.register
def wrpcap(filename, pkt, *args, **kargs):
 with PcapWriter(filename, *args, **kargs) as fdesc:
  fdesc.write(pkt)

@ conf . commands . register def wrpcap ( filename , pkt , * args , ** kargs ) : with PcapWriter ( filename , * args , ** kargs ) as fdesc : fdesc . write ( pkt )
write a list of packets to a pcap file gz: set to 1 to save a gzipped capture linktype: force linktype value endianness: "<" or ">" .