如何配置 Tshark/Wireshark .psml 文件的输出

How to configure the output of Tshark/Wireshark .psml file

我正在 Python 中创建一个简单的数据包分析器,用于分析 Tshark .xml 输出文件。

Tshark(相当于 Wireshark 的命令行)具有允许将所有数据包输出到 .psml 文件(数据包摘要标记语言)的功能。在 Wireshark 中,我可以通过 GUI 中的 adding/removing 选项卡配置导出的 .psml 文件的内容。但是,我找不到任何通过在 Tshark 中使用命令行来执行此操作的选项。

Wireshark 的示例输出:

<?xml version="1.0"?>
<psml version="0" creator="wireshark/2.0.0">
<structure>
<section>No.</section>
<section>Time</section>
<section>Source</section>
<section>Destination</section>
<section>Protocol</section>
<section>Length</section>
<section>Info</section>
<section>dBm</section>
</structure>

<packet>
<section>1</section>
<section>0.000000</section>
<section>xx:xx:xx:xx:xx:xx</section>
<section>Broadcast</section>
<section>802.11</section>
<section>223</section>
<section>Beacon frame, SN=1524, FN=0, Flags=........C, BI=100, SSID=xxx</section>
<section>4294967260 dBm</section>
</packet>

在 Tshark 中,我得到的输出没有 dBm (IEEE 802.11 RSSI) 部分。如何配置 Tshark 以在 .psml 文件中获取此数据?

PSML 显示的列将显示在 Wireshark 的摘要窗格中或 TShark 的输出中,而没有 -V,因此您需要请求 RSSI 列。

据推测 "adding/removing tabs" 你的意思是 "adding/removing columns"。

使用 command-line 选项尝试 运行 TShark

-o gui.column.format:'"No.", "%m", "Time", "%t", "Source", "%s", "Destination", "%d", "Protocol", "%p", "Length", "%L", "Info", "%i", "dBm", "%e"'

指定要显示的列或放入 PSML 输出中。

(不幸的是,Wireshark 2.x 中存在一个错误,其中 dBm 值是用 PSML 编写的,就好像它是 unsigned,所以,例如,-33 dBm显示为 4294967263。我已经检查了一个修复程序,所以它应该在 Wireshark 2.0.2 发布时修复。Wireshark 1.x 没有那个错误。)