lemontree55 / packetgen

Ruby library to easily generate and capture network packets
MIT License
98 stars 13 forks source link

Read pcap formatted files #45

Closed picatz closed 7 years ago

picatz commented 7 years ago

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.

Would love to know you thoughts on that. ⛵️

Lol

Otherwise, finally made that PR. 😊

sdaubert commented 7 years ago

Great job. Will add some specs before merging it.