This seems to work for me and handles the error packetgen has currently:
PacketGen::PcapNG::InvalidFileError: Incoherency in Header Block
from /.../lib/packetgen/pcapng/unknown_block.rb:58:in `read'
And returns an array of parsed packets when given a .pcap file. 🙌
Side Thought
Perhaps some defensiveness could be baked into handle packets that cannot be parsed upon reading a little more wisely. Perhaps that could be tinkered with a bit more. At least from reading the .pcap formatted files. I haven't read how PcapNG deals with packets that it cannot parse when reading from a file.
This seems to work for me and handles the error packetgen has currently:
And returns an array of parsed packets when given a
.pcap
file. 🙌Side Thought
Perhaps some defensiveness could be baked into handle packets that cannot be parsed upon reading a little more wisely. Perhaps that could be tinkered with a bit more. At least from reading the
.pcap
formatted files. I haven't read howPcapNG
deals with packets that it cannot parse when reading from a file.Would love to know you thoughts on that. ⛵️
Lol
Otherwise, finally made that PR. 😊