tshark
https://tshark.dev/
https://github.com/pocc/tshark.dev
How Is This Different from Wireshark Docs?
Most Wireshark documentation focuses on the GUI. In its many forms, it spans two Wireshark guides, multiple forums, a wiki, man pages, developer email chains, etc. That is not to say the existing documentation is not good. You will find what you are looking for eventually.
Being outside of the Wireshark project allows this website to cover topics that are external to it. Depending on the article, this can vary from scripting with bash or example usage of other programs. Tshark.dev and Wireshark docs are related but differ in their scopes.
Wireshark Display Filter for Unique Source/Destination IP and Protocol
When I've done that sort of thing before, I typically use tshark
to extract the data and then other tools (Python, Perl, awk, etc.) to further refine the resulting data. So with that approach in mind, you could use this:
tshark -r mysample.pcapng.gz -2 -Tfields -eip.src -eip.dst -eframe.protocols
With that command line, you'll get exactly those fields, but be aware that some lines, such as those with ARP packets, won't have IP addresses (because they're not IP packets), and that IPv6 packets won't show IP addresses because those field names (ip.src
and ip.dst
) are only for IPv4. Here's sample output from a capture file I happened to have handy:
10.68.40.152 224.0.0.252 eth:ethertype:ip:udp:dns
10.68.40.119 255.255.255.255 eth:ethertype:ip:udp:db-lsp-disc
10.68.40.119 10.68.41.255 eth:ethertype:ip:udp:db-lsp-disc
eth:ethertype:arp
10.68.40.152 224.0.0.252 eth:ethertype:ip:udp:dns
10.68.40.65 10.68.41.255 eth:ethertype:ip:udp:nbns
eth:ethertype:ipv6:ipv6.nxt:udp:dns
eth:ethertype:ipv6:ipv6.nxt:udp:dns
If you'd prefer to eliminate the non-IPv4 packets, just add a filter:
tshark -r mysample.pcapng.gz -2 -Tfields -R ip -eip.src -eip.dst -eframe.protocols
Under Linux (which is what I use), you can easily pipe the output of that into various other utility programs. For example, if you append this to that command line:
|sort -n |uniq -c |sort -n
You'll get list, in ascending order of frequency, of each unique src, dst and proto combination present within your sample file.
Wireshark Display Filter for Unique Source/Destination IP and Protocol
I think you'll have to use tshark
for this. One potential solution might be:
`tshark -r file.pcap -Y ip -T fields -e ip.src -e ip.dst -e _ws.col.Protocol | sort | uniq`
Note: If you want protocol numbers instead of protocol names, substitute -e ip.proto
for _ws.col.Protocol
, or use both if you prefer that.
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2018-09-07 string operation in powershell
2018-09-07 wirte function in powershell
2018-09-07 add environment path to powershell
2017-09-07 Can not Stop-Computer in powershell 6.0
2017-09-07 powershell无法拖动文件到命令行
2017-09-07 How to Download Windows 10 Spotlight/Lock Screen Images
2016-09-07 nuget.exe the application could not be started