feat: Support in-place GZIP reads for PCAPNG files#55
feat: Support in-place GZIP reads for PCAPNG files#55mosajjal merged 1 commit intogopacket:masterfrom globalcyberalliance:ng_gzip
Conversation
|
what does this add to the current method of leveraging |
|
@mosajjal Sorry, I'm not sure I follow what you mean. |
|
what I mean is, since func main() {
// open the gzip file as a io.reader
f, err := os.Open("./test.pcapng.gz")
if err != nil {
log.Fatal(err)
}
defer f.Close()
zipReader, err := gzip.NewReader(f)
if err != nil {
log.Fatal(err)
}
defer zipReader.Close()
// read the file
pcap, err := pcapgo.NewNgReader(zipReader, pcapgo.DefaultNgReaderOptions)
if err != nil {
log.Fatal(err)
}
// read the packets
for {
data, ci, err := pcap.ReadPacketData()
if err != nil {
break
}
log.Println(ci.Timestamp, len(data))
}
}what does your PR add that above code doesn't provide? |
|
Fly-by comment but it allows this: func main() {
// open the gzip file as a io.reader
f, err := os.Open("./test.pcapng.gz")
if err != nil {
log.Fatal(err)
}
defer f.Close()
// read the file
pcap, err := pcapgo.NewNgReader(f, pcapgo.DefaultNgReaderOptions)
if err != nil {
log.Fatal(err)
}It transparency decompresses the pcap if it is gzip compressed. Thus behaving the same way as wireshark's wiretap library. |
|
Hey @mosajjal! I'm sure you're busy, but is there any chance we could get this merged? Or is there anything I can do to help? I really appreciate the work you've put into maintaining this fork! |
|
Thank you! |
Hey!
This adds support for GZIP-compressed PCAPNG files. This borrows heavily from @bramp's PCAP implementation (google/gopacket#213)