MCPcopy Index your code
hub / github.com/secdev/scapy / wrpcap

Function wrpcap

scapy/utils.py:1263–1282  ·  view source on GitHub ↗

Write a list of packets to a pcap file :param filename: the name of the file to write packets to, or an open, writable file-like object. The file descriptor will be closed at the end of the call, so do not use an object you do not want to close (e.g., running wrpcap(sys.

(filename,  # type: Union[IO[bytes], str]
           pkt,  # type: _PacketIterable
           *args,  # type: Any
           **kargs  # type: Any
           )

Source from the content-addressed store, hash-verified

1261
1262@conf.commands.register
1263def wrpcap(filename, # type: Union[IO[bytes], str]
1264 pkt, # type: _PacketIterable
1265 *args, # type: Any
1266 **kargs # type: Any
1267 ):
1268 # type: (...) -> None
1269 """Write a list of packets to a pcap file
1270
1271 :param filename: the name of the file to write packets to, or an open,
1272 writable file-like object. The file descriptor will be
1273 closed at the end of the call, so do not use an object you
1274 do not want to close (e.g., running wrpcap(sys.stdout, [])
1275 in interactive mode will crash Scapy).
1276 :param gz: set to 1 to save a gzipped capture
1277 :param linktype: force linktype value
1278 :param endianness: "<" or ">", force endianness
1279 :param sync: do not bufferize writes to the capture file
1280 """
1281 with PcapWriter(filename, *args, **kargs) as fdesc:
1282 fdesc.write(pkt)
1283
1284
1285@conf.commands.register

Callers 3

sendpfastFunction · 0.90
tcpdumpFunction · 0.85
hexeditFunction · 0.85

Calls 2

PcapWriterClass · 0.85
writeMethod · 0.45

Tested by

no test coverage detected