我使用Pyshark
,它使用tshark
来解码pcap文件,我在使用'decode\'as'选项时遇到了一个问题。
我正在尝试将一个特定的UDP端口解码为SOMEIP协议。这是我添加的一个解剖器,它取自here。在
必须指出的是,剖析器和“解码为”选项在Wireshark中都能完美地工作。在
这是我使用的代码:
import pyshark
packets=pyshark.FileCapture(pcap_path, display_filter="udp")
packets.next() # Works fine
packets=pyshark.FileCapture(pcap_path, display_filter="udp", decode_as={"udp.port==50000":"someip"})
packets.next() # doesn't return a packet
还有一个被忽略的异常:
^{pr2}$正如它建议的那样,我使用调试模式(packets.set_debug()
),运行后我得到:
tshark: Protocol "someip" isn't valid for layer type "udp.port"
tshark: Valid protocols for layer type "udp.port" are:
....
然后是一长串协议,其中“someip”不在。。。(但我添加的另一个解析器是dll)
你知道这里怎么了吗? 是解剖造成的问题,还是我做错了什么?在
同样,当在Wireshark中手动完成时,“解码为”可以正常工作。
谢谢!在
编辑
所以我读过关于解析器表的文章,看起来应该没什么问题,因为解析器lua代码确实在解析器表中添加了“someip”udp.端口“:
local udp_dissector_table = DissectorTable.get("udp.port")
-- Register dissector to multiple ports
for i,port in ipairs{30490,30491,30501,30502,30503,30504} do
udp_dissector_table:add(port,p_someip)
tcp_dissector_table:add(port,p_someip)
end
我还尝试使用dissectortable:add_for_decode_as(proto)
函数(在11.6.2.11here中描述):
udp_dissector_table:add_for_decode_as(p_someip)
但没用
如有任何建议,将不胜感激,谢谢
目前没有回答
相关问题 更多 >
编程相关推荐