KimiNewt / pyshark

Python wrapper for tshark, allowing python packet parsing using wireshark dissectors
MIT License
2.26k stars 423 forks source link

version 0.5.3 cannt capture any package when using IPv6 #631

Open geyuchen opened 1 year ago

geyuchen commented 1 year ago

Describe the bug While using

bpf_filter = f"udp dst port {local_port}"

capture = pyshark.LiveCapture( bpf_filter=bpf_filter, output_file=pcap_file_path, use_json=True) capture.set_debug() capture.sniff(timeout=self.timeout, packet_count=self.packet_count) capture.close()

capturing packages from remote to local, I have such problem 👇: When local is ipv4, i can successfully capture data packets by pyshark and wireshark using bpffilter udp dst port {local_port}_. BUT when local is ipv6, i cannot capture any package by pyshark using same bpf_filte as above but success by wireshark. When I tried to solve the problem, I found that when the receiving end is IPv6 address, packets cannot be captured unless _bpffilter="".

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Versions (please complete the following information):

Example pcap / packet If applicable, add an example pcap file as an attachment, or post the packet as a hex string or a JSON/XML (export packet dissection in wireshark/tshark).

amlamarra commented 1 month ago

@geyuchen Have you tried this in v0.6?