Skip to content

i can't offline filtering from pcap file #920

@frkn4129

Description

@frkn4129

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))

			}
		}
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions