-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
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))
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels