使用 TShark 将加密的 SNMPv3 陷阱导出到 JSON

Exporting encrypted SNMPv3 traps to JSON with TShark

我有一个 pcap 文件,其中记录了来自 Wireshark(版本 3.2.2)的加密 SNMPv3 陷阱。为了分析陷阱,我想使用 tshark.

将协议数据导出到 json
tshark.exe -T ek -Y "snmp" -P -V -x -r input.pcap > output.json

目前,我通过 C:\Users\developer\AppData\Roaming\Wireshark.

中的“snmp_users”文件提供解密包的信息
# This file is automatically generated, DO NOT MODIFY.
,"snmp_user","SHA1","xxxxxx","AES","yyyyyyy"

是否可以通过命令行提供选项?

我试过:

tshark.exe -T ek -Y "snmp" -P -V -x -o "snmp.users_table.username:snmp_user" ...

但这会导致错误:

tshark: -o flag "snmp.users_table.username:snmp_user" specifies unknown preference

2020 年 9 月 16 日更新:
使用选项 -Y 代替 -J:

-Y|--display-filter
Cause the specified filter (which uses the syntax of read/display filters, rather than that of capture filters) to be applied before printing a decoded form of packets or writing packets to a file.

您需要将选项指定为 User Access Tableuat,具体的 table 是文件,即snmp_users。所以,例如:

在 Windows:

tshark.exe -o "uat:snmp_users:\"\",\"snmp_user\",\"SHA1\",\"xxxxxx\",\"AES\",\"yyyyyyy\"" -T ek -J "snmp" -P -V -x -r input.pcap > output.json

在 *nix 上:

tshark -o 'uat:snmp_users:"","snmp_user","SHA1","xxxxxx","AES","yyyyyyy"' -T ek -J "snmp" -P -V -x -r input.pcap > output.json

遗憾的是,Wireshark 文档目前缺少对 uat 选项的描述。不过,有一个 Google Summer of Code 项目正在进行中,Wireshark 正在参与其中,因此这里的文档可能会得到改进。