Lua 允许我“读入”吗? Wireshark 过滤器文本框中的文本?
我希望编写一个应用程序,读取 Wireshark 过滤器文本框中的任何过滤条件,然后使用 Lua 对其进行操作。有谁知道这是否可能?在深入学习 Lua 并将其与 Wireshark 一起使用之前,我想知道是否可能。
谢谢! 乔
I wish to write an app that reads whatever filter criteria is in the Wireshark filter text box and then manipulate it using Lua. Does anyone know if that is possible? I would like to know if it is possible before I get to deep into learning Lua and using it with Wireshark.
Thanks!
Joe
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,您无法读取它,但您可以设置过滤器并将其应用于当前捕获。请参阅 Wireshark 文档中的 GUI 支持部分。
要设置显示过滤器文本框的文本,请使用
set_filter(text)
。要应用显示过滤器的当前文本(使其生效),请使用
apply_filter()
。避免从解析器内调用
apply_filter()
(重新调用解析器可能会出现无限循环)。该函数更适合菜单操作或按钮操作。编辑:要将您自己的
get_filter()
Lua 函数添加到 Wireshark 的 Lua API(未经测试):funnel_get_filter() 的函数在
funnel_stat.c
< /a> (例如,参见第 468 行)。get_filter
添加到funnel_ops_t
(funnel.h:80
)。funnel_get_filter
添加到funnel_ops
,位于funnel_stat.c:546
和tap-funnel.c:90< /代码>
。确保根据
funnel_ops_t
将其添加到正确的数组索引处。wslua_gui.c
然后编译:/* TODO: 测试我!! */
No, you can't read it, but you can set the filter and apply it to the current capture. See the GUI Support section in the Wireshark docs.
To set the text of the display filter textbox, use
set_filter(text)
.To apply the current text of the display filter (make it take effect), use
apply_filter()
.Avoid calling
apply_filter()
from within a dissector (infinite loop can occur from re-invoking the dissector). The function is better suited in a menu action or a button action.EDIT: To add your own
get_filter()
Lua function to Wireshark's Lua API (untested):funnel_get_filter()
infunnel_stat.c
(see line 468 for example).get_filter
tofunnel_ops_t
(funnel.h:80
).funnel_get_filter
tofunnel_ops
atfunnel_stat.c:546
and attap-funnel.c:90
. Make sure you add it at the correct array index according tofunnel_ops_t
.wslua_gui.c
and then compile:/* TODO: Test me!! */