windows自帶工具netsh trace 抓包
簡單實例
管理員模式運行
netsh trace start capture=yes report=disabled protocol=TCP ipv4.address=192.168.0.40 tracefile=d:\a.etl
停止抓包
netsh trace stop
-------------------------------------------------------------
其它可選參數(shù)
report=enabled 則還會額外輸出系統(tǒng)的各類軟硬件及系統(tǒng)診斷配置信息并打包為cab格式。disabled
persistent=yes 即使重啟設(shè)備也會繼續(xù)抓包,除非運行netsh trace stop 。默認是no
fielmode=single|circular|append 默認為circular
maxsize 默認為250MB,如果不限制抓包文件大小需要設(shè)置maxsize=0 同時需要設(shè)置 filemode=single
overwrite=yes|no 抓包文件是否覆蓋原文件
correlation=yes: 不收集關(guān)聯(lián)事件 默認yes
指定源地址
IPv4.SourceAddress=<x.x.x.x>
IPv4.DstinstionAddress=<x.x.x.x>
protocol=<protocol>
例如:
protocol=6
protocol=!(TCP,UDP)
protocol=(4-10)
后面填寫協(xié)議名稱或協(xié)議號,其中
ICMP 協(xié)議號1
IPv4 協(xié)議號4
TCP 協(xié)議號6
UDP 協(xié)議號17
IPv6 協(xié)議號41
IPv6 icmp協(xié)議號58
IPv4.address=<x.x.x.x>
CaptureInterface=<interface name 或 GUID> 使用命令netsh trace show interfaces可查看可用的接口
例子:
CaptureInterface={716A7812-4AEE-4545-9D00-C10EFD223551}
CaptureInterface=!{716A7812-4AEE-4545-9D00-C10EFD223551}
CaptureInterface="Local Area Connection"
查詢其它可用的過濾條件
netsh trace show capturefilterhelp
------------------------------------------------------------------------------------
將抓包文件轉(zhuǎn)換為XML
netsh trace convert input=NetTrace-ICP.etl output=NetTrace-ICP.etl.xml dump=XML
生成的etl文件可用微軟件的network monitor查看 ,需要提前在Tools> options >Parser Profiles > windows 設(shè)置為Set As Active

若需要轉(zhuǎn)換為wireshark可查看的文件格式pcapng,需要使用到轉(zhuǎn)換工具
etl文件轉(zhuǎn)換轉(zhuǎn)換工具下載地址
https://github.com/microsoft/etl2pcapng/releases
etl2pcapng.exe <infile><outfile>
例子
etl2pcapng.exe capture.etl out.pcapng

浙公網(wǎng)安備 33010602011771號