Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
import pyshark pkts = pyshark.FileCapture("test.pcap") for p in pkts: print
我正在尝试打印 PCAP 文件中的所有目标端口和源端口。我怎么能做到?
import pyshark pkts = pyshark.FileCapture('cap.pcap') for p in pkts: if hasattr(p, 'tcp'): print(p.tcp.srcport + ' -- ' + p.tcp.dstport) if hasattr(p, 'udp'): print(p.udp.srcport + ' -- ' + p.udp.dstport)