Library usage¶
Use the FileScanner
class to iterate over blocks
in a pcap-ng archive file, like this:
from pcapng import FileScanner
with open('/tmp/mycapture.pcap') as fp:
scanner = FileScanner(fp)
for block in scanner:
pass # do something with the block...
Block types can be checked against blocks in pcapng.blocks
.