【Azure 环境】在Windows环境中抓取网络包(netsh trace)后,如何转换为Wireshark格式以便进行分析

问题描述

如何在Windows环境中,不安装第三方软件的情况下(使用Windows内置指令),如何抓取网络包呢?并且如何转换为Wireshark 格式呢?

 

操作步骤

1) 以管理员模式打开CMD,使用 netsh trace start capture=yes 命令开始抓取网络包,当需要停止时候,使用 netsh trace stop 指令。

复制代码
## 开始抓取
netsh trace start capture=yes ## 停止抓取 netsh trace stop ####执行结果 C:\LBWorkSpace\tool\nettrace1\newworktrace>netsh trace start capture=yes Trace configuration: ------------------------------------------------------------------- Status: Running Trace File: C:\Users\xxxx\AppData\Local\Temp\NetTraces\NetTrace.etl Append: Off Circular: On Max Size: 512 MB Report: Off C:\LBWorkSpace\tool\nettrace1\newworktrace>netsh trace stop Merging traces ... done Generating data collection ... done The trace file and additional troubleshooting information have been compiled as "C:\Users\xxxx\AppData\Local\Temp\NetTraces\NetTrace.cab". File location = C:\Users\xxxx\AppData\Local\Temp\NetTraces\NetTrace.etl Tracing session was successfully stopped.
复制代码

 

如果之抓取指定IP地址的网络包,可以使用如下命令:

netsh trace start capture=yes IPv4.Address=X.X.X.X

 

抓取动画效果为:

 

 

2) 使用 etl2pcapng.exe  工具进行格式转换,使用命令:

etl2pcapng.exe nettrace.etl nettrace.cap

 

3) 双击 nettrace.cap 打开 WireShark查看网络包,使用 ip.addr == xxx.xxx.xxx.xxx 多包中的内容进行过滤

 ip.addr == xxx.xxx.xxx.xxx  or ip.addr == xxx.xxx.xxx.xxx 

 

 

附录一:根据IP地址过滤Wireshark文件包,只导出特定的IP网络包

1)在Filter 输入框中输入过滤的IP地址: 如 ip.addr == 27.xxx.xxx.xxx

2)选择 File -->  Export Specified Packets --> Save

 

 

 

参考资料

etl2pcapng.exe 工具下载地址:https://files.cnblogs.com/files/lulight/etl2pcapng.zip

Wireshark 下载地址:https://www.wireshark.org/#download

posted @   路边两盏灯  阅读(1342)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示