tcp_follow listener in lua

asked 2021-10-25 11:08:17 +0000

I try to get tcp stream, but i can't find information how to do it in lua. I found 'tcp_follow' listener ant its work as tcp listener, i can't get correct data. My code is:

local function export_ally_list()

    -- Listener.new([tap], [filter], [allfields])
    local tap = Listener.new("tcp_follow", "ip.src == 85.17.202.49");
    local my_src = Address.ip("85.17.202.49")
    local fwarspear = Field.new("tcp.payload")
    local fullByteArray = ByteArray.new()

    local analyse_stopped  = false
    function tap.packet(pinfo,tvb, tapinfo)
        if analyse_stopped then
            return
        end

        if pinfo.src ~= my_src then
            return
        end

        local data1 = { fwarspear() }

        for k, v in pairs(data1) do
            local byteArray = v.value
            fullByteArray:append(byteArray) 
        end
    end
end

here is I have to get packets in right order (as tcp stream), but I get packets in order as it's received via network

edit retag flag offensive close merge delete