如何在Wireshark Lua解析器中访问数据包的TLS版本/校验和?
我是wireshark及其LuaAPI的新手。我需要编写一个解析器,它可以捕获端口443上的数据包,修改一些内容,然后将它们发送到目的地。我发现了一个脚本,我根据需要对其进行了修改:如何在Wireshark Lua解析器中访问数据包的TLS版本/校验和?,lua,wireshark,wireshark-dissector,Lua,Wireshark,Wireshark Dissector,我是wireshark及其LuaAPI的新手。我需要编写一个解析器,它可以捕获端口443上的数据包,修改一些内容,然后将它们发送到目的地。我发现了一个脚本,我根据需要对其进行了修改: -- create myproto protocol and its fields p_myproto = Proto ("myproto","My Protocol") local f_command = ProtoField.uint16("myproto.command", "Command", base.H
-- create myproto protocol and its fields
p_myproto = Proto ("myproto","My Protocol")
local f_command = ProtoField.uint16("myproto.command", "Command", base.HEX)
local f_data = ProtoField.string("myproto.data", "Data", FT_STRING)
p_myproto.fields = {f_command}
-- myproto dissector function
function p_myproto.dissector (buf, pkt, root)
print ('packet captured')
-- validate packet length is adequate, otherwise quit
if buf:len() == 0 then return end
pkt.cols.protocol = p_myproto.name
local colss = pkt.cols
--pkt.cols.info:append(" " .. tostring(pkt.dst).." -> "..tostring(pkt.src))
print ("" .. tostring(pkt.dst))
print ("" .. tostring(pkt.src_port))
print ("" .. tostring(pkt.dst_port))
end
-- Initialization routine
function p_myproto.init()
end
-- register a chained dissector for port 8002
local tcp_dissector_table = DissectorTable.get("tcp.port")
dissector = tcp_dissector_table:get_dissector(443)
-- you can call dissector from function p_myproto.dissector above
-- so that the previous dissector gets called
tcp_dissector_table:add(443, p_myproto)
我可以访问诸如dst、src、dst_端口等字段。整个列表可用。但是我在任何地方都找不到关于如何访问/修改数据包校验和、所选密码套件等的任何参考。我知道它们存在于传输层,但我找不到允许我访问/修改这些值的任何文档
我做错了什么?在此方面的任何帮助都将不胜感激
谢谢 您可以使用访问任何字段,整个列表在您引用的wiki页面上不可用,但在Wireshark页面上可用
例如,如果需要TCP校验和,可以使用:
fe_tcp_checksum = Field.new("tcp.checksum")
...
function p_myproto.dissector (buf, pkt, root)
...
f_tcp_checksum = fe_tcp_checksum().value
...
end
Wireshark wiki提供了更多信息。哦,你说得对。wireshark显示过滤器参考页是我找不到的。谢谢