i can't offline filtering from pcap file
Open
- Dominant language
- Go
- Stars
- 6.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I want to filter incoming packets and write them to a new file. But I can't filter. SetBPFFilter function returns empty.
what should I do ?
if handle, err := pcap.**OpenOffline**(/home/x/x/example.pcap); err != nil {
panic(err)
} else if err := **handle.SetBPFFilter(" port 80");** err != nil { // Filter
panic(err)
} else {
packetSource := gopacket.NewPacketSource(handle, handle.LinkType())
for packet := range packetSource.Packets() {
fmt.Println(packet) // Do something with a packet here.
writeFile(packet, fmt.Sprint(t.Id))
}
}
}
Contributor guide
Assessment
This issue has not been assessed yet.