如何知道 Wireshark 用 Lua 分析数据包已全部完成?

我刚学会如何在 Wireshark 中使用 Lua 分析我捕获的文件。

function tap.draw(t)
    tw:clear()
    tw:append("分析中...")
    print("调用绘制")
    print(max_number)
    print(max_number_bu_user)
    if tonumber(max_number)==tonumber(max_number_bu_user) then
        print("开始分析")
        if analyze_finished==false then
            if analyze_is_running==false then
                analyze_is_running=true
                local p=ProgDlg.new("cotp 分析","")
                local ok,errmsg=pcall(function ()
                    local co=coroutine.create(
                        function()
                            myanalyze()
                        end
                    )
                    coroutine.resume(co)
                end)
                p:close()
                if ok==true then
                    analyze_finished=true
                end
            end
        end
    end

tap.draw 函数将每 3 秒调用一次,直到所有数据包都通过 tap.packet 处理完毕。但在 tap.packet 中,我无法确定所有数据包处理完毕的时间。因此,我制作了一个对话框,让用户告诉我捕获文件中有多少个数据包(max_number_by_user)。在每次调用 tap.packet 时,max_number=max_number+1。在 tap.packet 中,我将所需的字段保存在表格中,并在 myanalyze() 函数中分析响应时间。 我认为应该有更好的方法,但我找不到。你能帮我吗?

原文链接 https://stackoverflow.com/questions/69477478

点赞