Wireshark 数据作为 ASCII
Wireshark Data as ASCII
我正在轮询远程示波器,答案是 "almost" 纯 ASCII:
"Almost" 因为 4 字节 header 80 00 00 15
(15
是 ASCII 消息的长度,在本例中为 21 字节)不让我在数据列中将有效负载解码为 ASCII(设置为 Custom/data.data
或 Custom/data.text
时):
Edit > Preferences > Protocols > Data
已经设置为 Show data as text
我想阅读 Follow TCP Stream
中的 ASCII 文本,它被正确解码并且无效的 ASCII 代码更改为 .
:
有没有办法在不编写解析器的情况下删除前 4 个字节?
我不了解 Lua,也不知道如何编写解析器:10.3. Example: Dissector written in Lua 远远超出我的理解。
欢迎任何指向我可以轻松改编的已发布解决方案的指针。
谢谢
跟随 MikaS tutorial(非常简单且制作精良!)我写了这个 LUA 解析器:
yokogawa_protocol = Proto("YokogawaWT3000", "Yokogawa WT3000 Protocol")
message_header0 = ProtoField.int32("yokogawa_protocol.message_header0", "messageHeader0", base.DEC)
message_header1 = ProtoField.int32("yokogawa_protocol.message_header1", "messageHeader1", base.DEC)
message_header2 = ProtoField.int32("yokogawa_protocol.message_header2", "messageHeader2", base.DEC)
message_length = ProtoField.int32("yokogawa_protocol.message_length", "messageLength", base.DEC)
message_ascii = ProtoField.string("yokogawa_protocol.message_ascii", "messageAscii", base.ASCII)
yokogawa_protocol.fields = { message_header0, message_header1, message_header2, message_length, message_ascii }
function yokogawa_protocol.dissector(buffer, pinfo, tree)
length = buffer:len()
if length == 0 then return end
pinfo.cols.protocol = yokogawa_protocol.name
local subtree = tree:add(yokogawa_protocol, buffer(), "Yokogawa WT3000 Protocol Data")
subtree:add(message_header0, buffer(0,1)) -- fixed h80
subtree:add(message_header1, buffer(1,1)) -- fixed h00
subtree:add(message_header2, buffer(2,1)) -- fixed h00
subtree:add(message_length, buffer(3,1)) -- ascii length
subtree:add(message_ascii, buffer(4, length-4)) -- ascii text
end
local tcp_port = DissectorTable.get("tcp.port")
tcp_port:add(10001, yokogawa_protocol)
Right-click messageAscii
,然后 "Apply as Column"
,让我在新列中查看每条消息的解码值。
谢谢大家
我正在轮询远程示波器,答案是 "almost" 纯 ASCII:
"Almost" 因为 4 字节 header 80 00 00 15
(15
是 ASCII 消息的长度,在本例中为 21 字节)不让我在数据列中将有效负载解码为 ASCII(设置为 Custom/data.data
或 Custom/data.text
时):
Edit > Preferences > Protocols > Data
已经设置为 Show data as text
我想阅读 Follow TCP Stream
中的 ASCII 文本,它被正确解码并且无效的 ASCII 代码更改为 .
:
有没有办法在不编写解析器的情况下删除前 4 个字节? 我不了解 Lua,也不知道如何编写解析器:10.3. Example: Dissector written in Lua 远远超出我的理解。 欢迎任何指向我可以轻松改编的已发布解决方案的指针。
谢谢
跟随 MikaS tutorial(非常简单且制作精良!)我写了这个 LUA 解析器:
yokogawa_protocol = Proto("YokogawaWT3000", "Yokogawa WT3000 Protocol")
message_header0 = ProtoField.int32("yokogawa_protocol.message_header0", "messageHeader0", base.DEC)
message_header1 = ProtoField.int32("yokogawa_protocol.message_header1", "messageHeader1", base.DEC)
message_header2 = ProtoField.int32("yokogawa_protocol.message_header2", "messageHeader2", base.DEC)
message_length = ProtoField.int32("yokogawa_protocol.message_length", "messageLength", base.DEC)
message_ascii = ProtoField.string("yokogawa_protocol.message_ascii", "messageAscii", base.ASCII)
yokogawa_protocol.fields = { message_header0, message_header1, message_header2, message_length, message_ascii }
function yokogawa_protocol.dissector(buffer, pinfo, tree)
length = buffer:len()
if length == 0 then return end
pinfo.cols.protocol = yokogawa_protocol.name
local subtree = tree:add(yokogawa_protocol, buffer(), "Yokogawa WT3000 Protocol Data")
subtree:add(message_header0, buffer(0,1)) -- fixed h80
subtree:add(message_header1, buffer(1,1)) -- fixed h00
subtree:add(message_header2, buffer(2,1)) -- fixed h00
subtree:add(message_length, buffer(3,1)) -- ascii length
subtree:add(message_ascii, buffer(4, length-4)) -- ascii text
end
local tcp_port = DissectorTable.get("tcp.port")
tcp_port:add(10001, yokogawa_protocol)
Right-click messageAscii
,然后 "Apply as Column"
,让我在新列中查看每条消息的解码值。
谢谢大家